Skip to content

Finding child node’s index

I have a parent div with some nested elements in it. They have the same class name without an id.
How can I get the value of a specific child node?

Answer

add id to your parent element, then

let parent = document.getElementById('parentid');
let chil = parent.children;