Jquery dynamic link removal
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.
Use unwrap
:
theImage.unwrap();
E.g.:
newLink.find("img").unwrap();
精彩评论