Reputation: 58
I want to put em tag before IMG tag dynamically , the image class is .photo.
<img class="photo" src="image.jpg" />
I want to convert this to
<em></em><img class="photo" src="image.jpg" />
using jQuery, I am using the append but its add the em in the img tag,
thanks.
Upvotes: 0
Views: 859
Reputation: 1800
jQuery("img").before("em")
EDIT: Okay, no need to add the closing tag.
Upvotes: 0