3
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 as well.
I know this is not a bug and it was supposed to happen already, but it has a method to alert only the text of #div
without including the button text?