<!DOCTYPE html>
<html lang="en-US">
<body>
<p>In this example, there will be no difference between "innerText" and "textContent".</p>
<p>Text without <b>spacing</b>.</p>
<button onclick="myinnerHTML()">innerHTML</button>
<button onclick="myinnerText()">innerText</button>
<button onclick="mytextContent()">textContent</button>
<script>
var y = document.getElementsByTagName("p")[1];
function myinnerHTML(){
alert(y.innerHTML);
}
function myinnerText(){
alert(y.innerText);
}
function mytextContent(){
alert(y.textContent);
}
</script> </body>
</html>