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