Why does this code check out ok?

Why does this code check out ok?
0.0 0

#1

O.K. I am confused the task is to get the second elemen in the ‘target’ class to bounce. Here is my code and it gets all check marks, but I do not understand why. There is not element called ‘target’, there is a ‘target1’, ‘target2’, and so on. So why does this code work?


#2

Are elements and classes the same thing?


#3

An element I believe refers to html elements that you create with <>. In jQuery I am still not sure what a class is.


#4

If class refers to html or css then I would have thought that it would be .well class. To me line 11, $(".target:nth-child(2)").addClass(“animated bounce”); does not make sense. How does the statement know which element to select? How does it know which child(2) to select to make bounce?


#5

you need to consider the parent-child relationship as well as the element-class relationship (the latter could also be class-element).

taking the “.target:nth-child(2)” statement specifically, if you were to translate this into plain english it would be “the second child element of any parent element with the .target class applied”


#6

I see what you are saying, any second child of any class. What gets me in the previous challenges we were asked to name specific elements, classes, and id’s then alll of a sudden here is an open ended statement. Thanks for your explanation it certainly helps me understand why this code cleared.