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);