0
$('.mydiv ul li:nth-child(4)').addClass("nth");

There are atleast 8 li's in there but it only selects 4th but not 8th?

3

1 Answer 1

5
$('.mydiv ul li:nth-child(4n)').addClass("nth");

pay attention to the 4n

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.