Jquery Remove Html Elements Inside Variable (jquery Object)
Inside HTML I have this DIV:
Solution 1:
No need for html()
var teaser = $(".teaser").find("img").remove();
EDIT:
Try this:
var teaser = $(".teaser").clone();
teaser.find("img").remove()
// use teaser
Solution 2:
if You want to remove the whole html. then you can use empty()method
$(".teaser").empty();
if you are removing image only. then
$(".teaser").find("img").remove();
Solution 3:
It's late, but try this $('img',$('.teaser')).remove().end().clone()
Post a Comment for "Jquery Remove Html Elements Inside Variable (jquery Object)"