Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js find node number in div

const child = document.getElementById('my_element');
const parent = child.parentNode;
// The equivalent of parent.children.indexOf(child)
const index = Array.prototype.indexOf.call(parent.children, child);
 
PREVIOUS NEXT
Tagged: #js #find #node #number #div
ADD COMMENT
Topic
Name
9+3 =