JSFiddle - React, Tailwind, and code Playground
by Roko
HTML
<div id="parent">
Get this
<span>Ignore this</span>
<p>Get this paragraph</p>
<div class="footer">Ignore this</div>
</div>
JavaScript
$.fn.ignore = function(sel){
return this.clone().find(sel||">*").remove().end();
};
var ignoreSpanAndFooter = $("#parent").ignore("span, .footer").html();
console.log(ignoreSpanAndFooter);