JSFiddle - React, Tailwind, and code Playground
HTML
<div class='myDiv'>
<p>hello</p>
hello
<p>Hello</p>
</div>
JavaScript
$(function() {
alert($('.myDiv')
.contents()
.filter(function() {
return this.nodeType == Node.TEXT_NODE;
}).text()
);
});