I have this code:
<div id="div">
This is some text.<br/>
<button>Button</button>
</div>
<script>
alert(document.getElementById("div").innerText);
</script>
And when I ask to alert the text of #div
, it alerts the button text too.
I know that this is not a bug and that it was supposed to happen, but does it have a method to only alert the text of #div
without including the button text?