How can I select the html of all elements nested under <div class="thewrapper">
except ones with class="excludeme" ?
<div class="thewrapper">
<div class="excludeme"> some content to exclude.... </div>
<div class="whatever">
<span> lots of content and tags </span>
</div>
<div class="excludeme"> some content to exclude again.... </div>
<div class="whatever">
<span> more content and tags </span>
</div>
I have been fiddling with jquery .not and :not operators and just cannot get it working. E.g. the following doesn't work:
var pagehtml = $("div[class^='thewrapper']:not(div[class^='excludeme']").html();
var pagehtml = $('div[class^="thewrapper"]').not('[class="excludeme"]').html();
var pagehtml = $("div.thewrapper:not(:has(div.excludeme))").html();
var pagehtml = $('div:not(".excludeme")').html();