Target a specific child with jQuery

Tell us what’s happening:
Hello, after running code it throws an error and does’nt let past:
// running tests
Only use jQuery to add these classes to the element.
// tests completed

Your code so far

Your browser information:
Google Chrome
Version 76.0.3809.132 (Official Build) (64-bit)

Link to the challenge:
https://learn.freecodecamp.org/front-end-libraries/jquery/target-a-specific-child-of-an-element-using-jquery

1 Like

Hi can you paste your code?

You should’ve learned how to target elements with the $("[element]") selector. If you did that, good for you.

as you read in the challenge, there is a function that allows you to target certain children in an element.

A little hint

$("[parent element you want to target]:nth-child([child's number])")
Note that you should keep the semicolon in the tag selector

Solution

keep this code in the document ready function:
$(".target:nth-child(2)").addClass("animated bounce")

I’ve found a working solution (with .target. This one below did throw the “jQuery” error, however should work imho either:

$(".well :nth-child(2)").addClass(“animated bounce”);