// HazaaZOOZ - javascript - How to get child of child javascript
var li = document.querySelector("li");
var number = 13;
li.children[0].children[0].innerHTML = number;
let content = document.getElementById('menu');
let firstChild = content.firstChild.nodeName;
console.log(firstChild);Code language: JavaScript (javascript)
var child_element = document.querySelector("#id").children[0];
//Where # defines id and '.' a class. And 0 argument the first child element
/*
<div id="parent">
<input value="off" />
<button type="button">Click Me</button>
</div>
*/
const input = document.querySelector('#parent input');
const button = document.querySelecctor('#parent button');
let firstChild = parentElement.firstChild;
Code language: JavaScript (javascript)
let lastChild = parentElement.lastElementChild;Code language: JavaScript (javascript)