--- id: bad87fee1348bd9aeda08826 title: Target Elements by id Using jQuery required: - link: 'https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.2.0/animate.css' challengeType: 6 videoUrl: '' localeTitle: id的目标元素使用jQuery --- ## Description
您还可以通过其id属性来定位元素。首先使用$("#target3")选择器将您的button元素与id target3 $("#target3") 。请注意,就像CSS声明一样,您在id的名称前键入# 。然后使用jQuery的.addClass()函数添加animated类和fadeOut 。以下是如何使用id target6淡出的button元素: $("#target6").addClass("animated fadeOut")
## Instructions
## Tests
```yml tests: - text: 选择idtarget3button元素,并使用jQuery addClass()函数为它提供animated类。 testString: 'assert($("#target3").hasClass("animated"), "Select the button element with the id of target3 and use the jQuery addClass() function to give it the class of animated.");' - text: 使用id target3定位元素,并使用jQuery addClass()函数为其提供类fadeOut 。 testString: 'assert(($("#target3").hasClass("fadeOut") || $("#target3").hasClass("fadeout")) && code.match(/\$\(\s*.#target3.\s*\)/g), "Target the element with the id target3 and use the jQuery addClass() function to give it the class fadeOut.");' - text: 只使用jQuery将这些类添加到元素中。 testString: 'assert(!code.match(/class.*animated/g), "Only use jQuery to add these classes to the element.");' ```
## Challenge Seed
```html

jQuery Playground

#left-well

#right-well

```
## Solution
```js // solution required ```