Answers for "how to find the index of an item in nodelist in js"

1

how to find the index of an item in nodelist in js

let nodes = document.getElementsByTagName('*');
Array.prototype.indexOf.call(nodes, document.body);
Posted by: Guest on June-09-2021
3

js find index in list

let myList = ['foo', 'bar', 'qux'];

myList.indexOf('bar');	// 1
Posted by: Guest on July-18-2020

Code answers related to "how to find the index of an item in nodelist in js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language