--- id: bad87fee1348bd9aed908826 title: Change the CSS of an Element Using jQuery required: - link: 'https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.2.0/animate.css' challengeType: 6 videoUrl: '' localeTitle: 使用jQuery更改元素的CSS --- ## Description
我们也可以使用jQuery直接更改HTML元素的CSS。 jQuery有一个名为.css()的函数,允许您更改元素的CSS。以下是我们将其颜色更改为蓝色的方法: $("#target1").css("color", "blue");这与普通的CSS声明略有不同,因为CSS属性及其值在引号中,并用逗号而不是冒号分隔。删除jQuery选择器,留下一个空的document ready function 。选择target1并将其颜色更改为红色。
## Instructions
## Tests
```yml tests: - text: 您的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.");' ```
## Challenge Seed
```html

jQuery Playground

#left-well

#right-well

```
## Solution
```js // solution required ```