how to change the text of p tag with js code example Example: set text of dom element document.getElementById("myBtn").textContent = 'Hello World';