adding a to element javascript code example
Example: 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>