$("#target3")选择器将您的button元素与id target3 $("#target3") 。请注意,就像CSS声明一样,您在id的名称前键入# 。然后使用jQuery的.addClass()函数添加animated类和fadeOut 。以下是如何使用id target6淡出的button元素: $("#target6").addClass("animated fadeOut") 。 id为target3的button元素,并使用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.");'
```