$("#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.");'
```