I want to find the index of the child div that has the id \'whereami\'.
\'whereami\'
> 9条回答 死守一世寂寞 (楼主) 2020-12-13 07:14 By co-opting Array indexOf you could use : var wmi = document.getElementById ('whereami'); index = [].indexOf.call (wmi.parentNode.children, wmi); [Tested on Chrome browser only] 0 讨论(0) 查看其它9个回答 发布评论: 提交评论 加载中... 验证码 看不清? 提交回复
By co-opting Array indexOf you could use :
Array
indexOf
var wmi = document.getElementById ('whereami'); index = [].indexOf.call (wmi.parentNode.children, wmi);
[Tested on Chrome browser only]