--- 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 forumTopicId: 18315 localeTitle: Назначение определенного дочернего элемента элемента с помощью jQuery --- ## Description
Вы видели, почему атрибуты id настолько удобны для таргетинга с помощью селекторов jQuery. Но у вас не всегда будут такие опрятные идентификаторы для работы. К счастью, у jQuery есть некоторые другие трюки для ориентации на нужные элементы. jQuery использует селектора CSS для целевых элементов. target:nth-child(n) селектор target:nth-child(n) CSS позволяет вам выбрать все n-ые элементы с целевым классом или типом элемента. Вот как вы бы дали третий элемент в каждой скважине класс отказов: $(".target:nth-child(3)").addClass("animated bounce"); Сделайте второго ребенка в каждом из элементов вашего колодца. Вы должны выбрать дочерние элементы элементов с target классом.
## 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")); - text: Only two elements should bounce. testString: assert($(".animated.bounce").length === 2); - text: You should use the :nth-child() selector to modify these elements. testString: assert(code.match(/\:nth-child\(/g)); - 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)); ```
## Challenge Seed
```html

jQuery Playground

#left-well

#right-well

```
## Solution
```html

jQuery Playground

#left-well

#right-well

```