--- id: bad87fee1348bd9aed908826 title: jQuery を使用して要素の CSS を変更する challengeType: 6 forumTopicId: 16776 required: - link: 'https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.2.0/animate.css' dashedName: change-the-css-of-an-element-using-jquery --- # --description-- jQuery を使用して HTML 要素の CSS を直接変更することもできます。 jQuery には `.css()` という関数があり、要素の CSS を変更することができます。 色を青に変更する方法を次に示します。 ```js $("#target1").css("color", "blue"); ``` これは通常の CSS 宣言とは多少異なります。CSS のプロパティとその値は引用符で囲みますが、コロンではなくコンマで区切ります。 jQuery のセレクターを削除し、空の `document ready function` を残してください。 `target1` を選択し、その色を赤に変更してください。 # --hints-- `target1` 要素のテキストを赤にします。 ```js assert($('#target1').css('color') === 'rgb(255, 0, 0)'); ``` jQuery のみを使用して、これらのクラスを要素に追加してください。 ```js assert(!code.match(/class.*animated/g)); ``` # --seed-- ## --seed-contents-- ```html

jQuery Playground

#left-well

#right-well

``` # --solutions-- ```html

jQuery Playground

#left-well

#right-well

```