set innertext property from HTML instead of javascript code example Example: HTML DOM innerText var x = document.getElementById("myBtn").innerText;