javascript - How to remove element from HTML string? -
this doesn't seem working, uncaught type error on .remove() line:
js:
var str = $("a").html(); var $html = $.parsehtml(str); $("i",$html).remove(); $("div").html($html); html:
<a href="#">hello <i>bob</i></a> <div></div> how work?
you can clone a, change html code of clone , put clone inside div.
$(document).ready(function() { var clone = $("a").clone(); clone.find("i").remove(); $("div").html(clone); });
Comments
Post a Comment