--- id: bad87fee1348bd9bedc08826 required: - link: 'https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.2.0/animate.css' challengeType: 6 forumTopicId: 18319 title: 使用 jQuery 配合元素选择器选择元素 --- ## Description
接下来我们学习document ready function。 首先,我们完成第一个 jQuery 语句。所有的 jQuery 函数以$开头,这个符号通常被称为美元符号(dollar sign operator)bling。 jQuery 通常选取并操作带有选择器(selector)的 HTML 标签。 例如,如果要所有button有弹性的动画效果,只需在document ready function中添加如下代码即可: $("button").addClass("animated bounce"); 请注意,为了能在编辑器里直接使用,我们已经为你在后台引入了 jQuery 库和 Animate.css 库。因此,你只需要通过 jQuery 给button元素添加bounce类就可以了。
## Instructions
## Tests
```yml tests: - text: 用 jQuery 的addClass()方法给button标签添加animatedbounce类。 testString: 'assert($("button").hasClass("animated") && $("button").hasClass("bounce"));' - text: 仅用 jQuery 给标签添加颜色。 testString: 'assert(!code.match(/class.*animated/g));' - text: jQuery 代码应该放在$(document).ready();函数里。 testString: assert(code.match(/\$\(document\)\.ready\(function.*(\s|\n)*.*button.*.addClass.*\);/g)); ```
## Challenge Seed
```html

jQuery Playground

#left-well

#right-well

```
## Solution
```html

jQuery Playground

#left-well

#right-well

```