Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

change text in html with javascript

// assume we have a <p> element with the id "text"

const text = document.getElementById("text")
text.innerHTML = "<h1>hey</h1>" // now it's a <h1> element
Source by w3schools.com #
 
PREVIOUS NEXT
Tagged: #change #text #html #javascript
ADD COMMENT
Topic
Name
9+5 =