Syntax for nth child (JS/jQuery)
:nth-child(n | even | odd | formula)
|n||Index of child element. The first element has index 1 and not 0.|
|even||Selects each even child in the parent element.|
|odd||Selects each old child|
|formula||Specifies which child element to be selected with formula an+b|
Examples & Demo for nth-child Selection with JS
Let’s look at an example to understand better.
Hope the article was informative and you got to learn something new. Comment below in case you have any queries.