set in div js code example
Example 1: set text of dom element
document.getElementById("myBtn").textContent = 'Hello World';
Example 2: javascript update text in div
fieldNameElement.innerHTML = "My new text!";
document.getElementById("myBtn").textContent = 'Hello World';
fieldNameElement.innerHTML = "My new text!";