Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

How To Add A New Element To HTML DOM

  var p = document.createElement("p");
   var text = document.createTextNode("This is a new element");
   p.appendChild(text);
   var element = document.getElementById("new");
   element.appendChild(p);
Source by www.tutorialspoint.com #
 
PREVIOUS NEXT
Tagged: #How #To #Add #A #New #Element #To #HTML #DOM
ADD COMMENT
Topic
Name
1+3 =