addClass()
函数,你可以用jQuery的删除它们removeClass()
函数。以下是为特定按钮执行此操作的方法: $("#target2").removeClass("btn-default");
让我们从所有button
元素中删除btn-default
类。 button
元素中删除btn-default
类。
testString: 'assert($(".btn-default").length === 0, "Remove the btn-default
class from all of your button
elements.");'
- text: 仅使用jQuery从元素中删除此类。
testString: 'assert(code.match(/btn btn-default/g), "Only use jQuery to remove this class from the element.");'
- text: 只删除btn-default
类。
testString: 'assert(code.match(/\.[\v\s]*removeClass[\s\v]*\([\s\v]*("|")\s*btn-default\s*("|")[\s\v]*\)/gm), "Only remove the btn-default
class.");'
```