javascript select child element by id code example
Example 1: select child javascript
Syntax
element.children
Example
Change the background color of the second child element of a <div> element:
var c = document.getElementById("myDIV").children;
c[1].style.backgroundColor = "yellow";
Example 2: how to get child element in javascript
let lastChild = parentElement.lastElementChild;Code language: JavaScript (javascript)