Let suppose I need to extract every text from specific html tag:
HTML:
<div id="container">
<div id="subject">
<span><a></a></span>
</div>
</div>
var subject = document.getElementById('subject').innerHTML;
console.log(subject); // <span><a></a></span>
So we don’t have any text inside, but if there is - how to check if there is text outside of <> tags inside our specific html element?
fiddle for better visualization - http://jsfiddle.net/kxarc6o3/