user979390 user979390 - 11 months ago 38
HTML Question

How to create link element with image as anchor with jquery?

I know how to create elements with jquery using something like:


How can I create this:

<a href=""><img src="" /></a>

Using the same technique?

Answer Source
$('<img />').attr({
  src:'some image url',
  width:'width in intiger',
}).appendTo($('<a />').attr({