1
2
3
4
5 let content = document.getElementById('menu');
6let firstChild = content.firstChild.nodeName;
7console.log(firstChild);Code language: JavaScript (javascript)
1Syntax
2element.children
3
4Example
5Change the background color of the second child element of a <div> element:
6
7var c = document.getElementById("myDIV").children;
8c[1].style.backgroundColor = "yellow";