<p id="text">1</p> <button id="btn">Change</button> <script> document.getElementById("btn").addEventListener("click", function() { document.getElementById("text").innerText = "2" }) </script>