change element text dom 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';