Freecodecamp: Conflicting instructions on Waypoint: Target a Specific Child of an Element Using jQuery

Created on 7 Aug 2015  路  12Comments  路  Source: freeCodeCamp/freeCodeCamp

In the instructions it states to make the first child in each of your well elements bounce. This conflicts with the first checkpoint which states that the second element in each of your "well" elements should bounce.

screenshot 3

Most helpful comment

use the following code, misleading info on mine also

$('.target:nth-child(2)').addClass('animated bounce');

this worked on mine.. took half hour to do this one. Yes the info is misleading

All 12 comments

this is being tracked in #1713

use the following code, misleading info on mine also

$('.target:nth-child(2)').addClass('animated bounce');

this worked on mine.. took half hour to do this one. Yes the info is misleading

Thanks @bbhanda2

@bbhanda2 it's a bug.

If we are talking about child the .target should be the .well.

Thanks guys. I am really enjoying the camp.

So what does the "2" do? Don't understand that and why it needed to be changed from "3". Thanks!

Why we use .target ? Why i can't use
$('.well:nth-child(2)').addClass('animated bounce');

I have 3 #target5 button.. can someone help?

image

I also, initially, used this: $(".well:nth-child(2)").addClass("animated bounce");
Why is this not correct? It would target the .well for both and animate the second button in each well. Can someone please explain why this isn't correct? I don't see a target class, only id's, and each id is distinct.

After looking at it, it dawned on me. Here is some text from the challenge: jQuery uses CSS Selectors to target elements. target:nth-child(n) css selector allows you to select all the nth elements with the target class or element type. We gave all of our buttons these classes, separated by spaces: "btn btn-default target". So, the jQuery command we are using is specifying the second instance of target in each well. How? I don't know, because it looks like it should be $(".well:nth-child(2)").addClass("animated bounce);, since the exercise is calling for you to target children and not pinpoint directly. I think there should be a more detailed explanation on the exercise page about this. Very confusing and I hate not knowing something before I move to the next lesson, lol.

removed solution by mod

$(".target:nth-child(2)").addClass("animated bounce");
is the answer
i typed the same code earlier but it doesnt worked but after a long struggle it worked
seems like a bug to me

Was this page helpful?
0 / 5 - 0 ratings

Related issues

raisedadead picture raisedadead  路  3Comments

trashtalka3000 picture trashtalka3000  路  3Comments

kokushozero picture kokushozero  路  3Comments

danielonodje picture danielonodje  路  3Comments

jurijuri picture jurijuri  路  3Comments