--- id: bad87fee1348bd9aedc08826 title: Target Elements by Class Using jQuery required: - link: 'https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.2.0/animate.css' challengeType: 6 videoUrl: '' localeTitle: 使用jQuery按类目标元素 --- ## Description
您看到我们如何使所有button元素反弹?我们用$("button")选择它们,然后我们用.addClass("animated bounce");为它们添加了一些CSS类.addClass("animated bounce"); 。您刚刚使用了jQuery的.addClass()函数,它允许您向元素添加类。首先,让我们使用$(".well")选择器将你的div元素与类well对准。请注意,就像CSS声明一样,您键入一个.在课堂名称之前。然后使用jQuery的.addClass()函数中添加类animatedshake 。例如,您可以通过将以下内容添加到document ready function来创建具有类text-primary shake的所有元素: $(".text-primary").addClass("animated shake");
## Instructions
## Tests
```yml tests: - text: 使用jQuery addClass()函数为类赋予animated并使用类well shake所有元素。 testString: 'assert($(".well").hasClass("animated") && $(".well").hasClass("shake"), "Use the jQuery addClass() function to give the classes animated and shake to all your elements with the class well.");' - 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 ```