change text of dom JS code example
Example 1: change text of element js
document.getElementById("p1").innerHTML = "New text!";
Example 2: set text of dom element
document.getElementById("myBtn").textContent = 'Hello World';
document.getElementById("p1").innerHTML = "New text!";
document.getElementById("myBtn").textContent = 'Hello World';