DOM - Root Node of the document

1 - About

Root Node of the document

3 - Javascript


var rootElement = document.documentElement;
var firstTier = rootElement.childNodes;

// firstTier is the NodeList of the direct children of the root element
console.log("The child nodes of the root element are");
for (var i = 0; i < firstTier.length; i++) {
   // do something with each direct kid of the root element
   // as firstTier[i]
   console.log("Node "+i+": Tag Name="+firstTier[i].tagName+", Node Type="+firstTier[i].nodeType);


Data Science
Data Analysis
Data Science
Linear Algebra Mathematics

Powered by ComboStrap