jQuery :nth-child() Selector

Last Updated Jul 21, 2015, 12:00:06 PM

jQuery :nth-child() Selector

Matches all elements that are the nth-child of their parent or that are the parent's even or odd children.

index: The index of each child to match, starting with 1, the string even or odd, or an equation ( eg. :nth-child(even), :nth-child(4n) )


The below example selects every second element in each parent of second child because in our case :nth-child(2)

In the above HTML the jquery :nth-child selector will select every second element

jquery nth-child selector

Try It Now

All jQuery Child Selectors

Other Advanced jQuery Selectors you might want to learn
jQuery Complete Selectors Reference

jQuery Selectors

jQuery Basic Selectors

jQuery Child Selectors

jQuery Content Filter Selectors

Sources and Credits

The content and methods in the tutorial has been referred and updated with jQuery API and The jQuery Foundation

Last Updated Jul 21, 2015, 12:00:06 PM