JSFiddle - React, Tailwind, and code Playground
by jfriend00
HTML
<div id="foo">
<img src="foo.png" /> <img src="foo.png" /> <img src="foo.png" />
</div>
JavaScript
$("#foo").contents().filter(function() {
if (this.nodeType == 3) {
return(this.nodeValue.replace(/\s| /g, "") == "");
}
return(false);
}).remove();
alert("'" + document.getElementById("foo").innerHTML + "'");