.css()
的函数,允许您更改元素的CSS。以下是我们将其颜色更改为蓝色的方法: $("#target1").css("color", "blue");
这与普通的CSS声明略有不同,因为CSS属性及其值在引号中,并用逗号而不是冒号分隔。删除jQuery选择器,留下一个空的document ready function
。选择target1
并将其颜色更改为红色。 target1
元素应该有红色文本。
testString: 'assert($("#target1").css("color") === "rgb(255, 0, 0)", "Your target1
element should have red text.");'
- text: 只使用jQuery将这些类添加到元素中。
testString: 'assert(!code.match(/class.*animated/g), "Only use jQuery to add these classes to the element.");'
```