Answers for "javascript create element with inner tags"

12

js create element

var newDiv = document.createElement("div");
document.body.appendChild(newDiv);
Posted by: Guest on April-04-2020
1

create and append element in javascript

//create and append element
 var node = document.createElement("LI");                 // Create a <li> node

 var textnode = document.createTextNode("Water");         // Create a text node

 node.appendChild(textnode);                              // Append the text to <li>

 document.getElementById("myList").appendChild(node);
Posted by: Guest on December-30-2020

Code answers related to "javascript create element with inner tags"

Code answers related to "Javascript"

Browse Popular Code Answers by Language