--- id: bad87fee1348bd9aed108826 title: Target a Specific Child of an Element Using jQuery required: - link: 'https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.2.0/animate.css' challengeType: 6 --- ## Description
You've seen why id attributes are so convenient for targeting with jQuery selectors. But you won't always have such neat ids to work with. Fortunately, jQuery has some other tricks for targeting the right elements. jQuery uses CSS Selectors to target elements. The target:nth-child(n) CSS selector allows you to select all the nth elements with the target class or element type. Here's how you would give the third element in each well the bounce class: $(".target:nth-child(3)").addClass("animated bounce"); Make the second child in each of your well elements bounce. You must select the elements' children with the target class.
## Instructions
## Tests
```yml tests: - text: The second element in your target elements should bounce. testString: assert($(".target:nth-child(2)").hasClass("animated") && $(".target:nth-child(2)").hasClass("bounce"), 'The second element in your target elements should bounce.'); - text: Only two elements should bounce. testString: assert($(".animated.bounce").length === 2, 'Only two elements should bounce.'); - text: You should use the :nth-child() selector to modify these elements. testString: assert(code.match(/\:nth-child\(/g), 'You should use the :nth-child() selector to modify these elements.'); - text: Only use jQuery to add these classes to the element. testString: assert(code.match(/\$\(".target:nth-child\(2\)"\)/g) || code.match(/\$\('.target:nth-child\(2\)'\)/g) || code.match(/\$\(".target"\).filter\(":nth-child\(2\)"\)/g) || code.match(/\$\('.target'\).filter\(':nth-child\(2\)'\)/g), 'Only use jQuery to add these classes to the element.'); ```
## Challenge Seed
```html

jQuery Playground

#left-well

#right-well

```
## Solution
```html

jQuery Playground

#left-well

#right-well

```