It's easy to clone your HTML file with jQuery:
alert($("html").clone().html());
My goal is to clone the whole program except divs of class '.ignore' but the best I can do is display ONLY those divs.
// This displays the inverse of what I want: just the code to be removed
alert($("html").clone().find('.ignore').remove().html());
// Seems to have the exact same effect as above:
alert($("html").clone().find('.ignore').html());
What's the best way to obtain all but the specified div class?
You could use the .end
function
alert($("html").clone().find('.ignore').remove().end().html());
A working fiddle is here: http://jsfiddle.net/sh99ognm/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With