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