jquery - How to get html() from element excluding another element? -


sorry real stupid question. 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   }); </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 it:

var clone = $('div.content').clone(); clone.find('.dontgrab').remove();  var html = clone.html(); 

Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -