How to get content from a Div that has a span which also has some content?
<div id="test">
this is a DIV
<span>
This is a span
</span>
</div>
alert(document.getElementById('test').innerText);
The code alerts me with This is a DIV This is a span.Im looking to get the content only from the DIV.
Use
nodeValue:Demo on jsfiddle