Question about jquery targeting specific child element

Question about jquery targeting specific child element
0

#1

So in pic bellow i learned how to select specific child of element, previously i found out that parent, parents and children functions work for nested elements only, finnaly. So now im curious if function .target:nth- child(n) targets child of all nested elements in a document? Example is down bellow.


#2

It targets children who’s order within the nearest parent is a specific value (nth). See the following thread with examples on using nth-child function.


#3

Ok so it basicaly targets every single for example second element of every div in a document? Did i understand this correctly? nth means nearest?


#4

Try reading the official documentation of nth-child (below) and see if it answers some of your questions. In the thread I posted above, there are some very good examples of how it is used.

The best way to see if you understand how to use this function is to play around with the code to see what different configurations do to the elements.