Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

change text js

<p id="text">1</p>
<button id="btn">Change</button>
<script>
document.getElementById("btn").addEventListener("click", function() {
    document.getElementById("text").innerText = "2"
})
</script>
Source by w3schools.com #
 
PREVIOUS NEXT
Tagged: #change #text #js
ADD COMMENT
Topic
Name
8+7 =