document ready function 。现在让我们编写第一个jQuery语句。所有jQuery函数都以$开头,通常称为dollar sign operator ,或者作为bling 。 jQuery经常选择带有selector的HTML元素,然后对该元素执行某些操作。例如,让我们使所有button元素反弹。只需在您的文档就绪函数中添加此代码: $("button").addClass("animated bounce");请注意,我们已经在后台包含了jQuery库和Animate.css库,以便您可以在编辑器中使用它们。所以你使用jQuery将Animate.css bounce类应用于你的button元素。 addClass()函数将类animated并bounce回到button元素。
testString: 'assert($("button").hasClass("animated") && $("button").hasClass("bounce"), "Use the jQuery addClass() function to give the classes animated and bounce to your button elements.");'
- text: 只使用jQuery将这些颜色添加到元素中。
testString: 'assert(!code.match(/class.*animated/g), "Only use jQuery to add these colors to the element.");'
- text: 你的jQuery代码应该在$(document).ready();功能。
testString: 'assert(code.match(/\$\(document\)\.ready\(function.*(\s|\n)*.*button.*.addClass.*\);/g), "Your jQuery code should be within the $(document).ready(); function.");'
```