Reputation: 2110
Consider the following
var newLink = $('<a/>').attr('href', name);
previewImage.wrap(newLink);
It outputs
<a href><img src=" "/></a>
I need some Jquery code to modify this to:
<img src=" "/>
(Only remove the wrapping link without the img). Any help will be greatly appreciated.
Upvotes: 1
Views: 142
Reputation: 1074268
Use unwrap
:
theImage.unwrap();
E.g.:
newLink.find("img").unwrap();
Upvotes: 1