Issue
I am trying to select an element using CSS but the closest I can get is a nodelist using document.querySelectorAll() in the developer console. Is there a way of selecting a specific position in the nodelist like you can a standard array e.g. nodelist[3]?
Solution
You can use nth-child() to select a sibling element by index (one-based). For example, if you had something like div > ul > li:nth-child(3), it would retrieve the third <li> element available per that selector.
Answered By - Whit Waldo
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.