I have a code snippet below (the currentUser class is in a different list item depending on who is viewing the page).
<ul> <li>user 1</li> <li>user 2</li> <li class="currentUser">user 3</li> <li>user 4</li> </ul> var curLth = jQuery('.currentUser').index(); console.log(curLth); //outputs 2
The site I'm working on doesn't load jQuery, so I want to know which list item the currentUser class currentUser without using jQuery
I checked the NodeList in dev tools, but did not see anything that I could use to get it.
How can this be achieved?
source share