user979390 user979390 - 1 year ago 96
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({
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download