0

Dom

What's the meanings of child node

9th May 2018, 12:35 PM
Ahmed Hussin
Ahmed Hussin - avatar
3 Answers
+ 6
tags that starts and ends within an another tag is called child node eg: <body> tag has a child <p> and <h1>
9th May 2018, 12:41 PM
‎ ‏‏‎Anonymous Guy
+ 3
Thanks so Much
9th May 2018, 12:44 PM
Ahmed Hussin
Ahmed Hussin - avatar
+ 2
function setText() { var a = document.getElementById("demo"); console.log(a); if(a != null && a.hasChildNodes()){ var arr = a.childNodes; for(var x=0;x<arr.length;x++) { arr[x].innerHTML = "new text"; } } else { alert(" No Child Nodes"); } } //calling the function with setTimeout to make sure the HTML is loaded setTimeout(setText, 500);
15th Mar 2020, 9:13 AM
Zahid Nazir Khan
Zahid Nazir Khan - avatar