javascript set element text 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';
Example 3: javascript element edit text
// example:
document.querySelector(`.message`).textContent = `New Message`;
// syntax:
// document.querySelector(`.<class-name>`).textContent = `<new-value>`;