How to select nth element HTML using JavaScript?

In jquery there is a function
$('.class').eq(nth num);
You need to realize that certain functions only in pure js, how can I do that?
March 23rd 20 at 19:09
2 answers
March 23rd 20 at 19:11
Solution
document.querySelectorAll('.class')[nth-num]
Not working) - pearline_Daniel commented on March 23rd 20 at 19:14
@pearline_Daniel, all of the code?
variable differently, call
https://codepen.io/kickerock/pen/QRPxpz?editors=1111 - dale75 commented on March 23rd 20 at 19:17
Thank you very much - pearline_Daniel commented on March 23rd 20 at 19:20
March 23rd 20 at 19:13
Solution
document.querySelector('#el div:nth-child(2)')
But if the objects will be in different containers? - pearline_Daniel commented on March 23rd 20 at 19:16

Find more questions by tags JavaScript