put text between paragraph javascript code example
Example 1: javascript append to paragraph
// In the JS script
var parElement = document.getElementById("myPar");
var textToAdd = document.createTextNode("Text to be added");
parElement.appendChild(textToAdd);
//In the HTML file
<p id="myPar"></p>
Example 2: set text of dom element
document.getElementById("myBtn").textContent = 'Hello World';