Sorry for real stupid question. But it does not work either way.
<html>
<head>
<script src='js/jquery.js' type='text/javascript'></script>
<script type='text/javascript'>
$(document).ready(function() {
var htmlcontent = $('.content').not('.dontgrab').html();
alert(htmlcontent); // returns EVERYTHING
});
</script>
</head>
<body>
<div class='content'>
BEFORE
<div class='dontgrab'>DON'T GRAB</div>
AFTER
</div>
</body>
</html>
Tried $(".content *:not('.dontgrab')").html(); // returns NULL
Please help.
Thanks.
This should do it:
var clone = $('div.content').clone();
clone.find('.dontgrab').remove();
var html = clone.html();
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