2018-10-10 18:03:03 -04:00
|
|
|
---
|
|
|
|
id: bad87fee1348bd9aec908852
|
2020-12-16 00:37:30 -07:00
|
|
|
title: 分别给每个目标元素的 class 属性添加一个 target 值
|
2018-10-10 18:03:03 -04:00
|
|
|
challengeType: 0
|
2020-09-07 16:17:39 +08:00
|
|
|
forumTopicId: 16815
|
2018-10-10 18:03:03 -04:00
|
|
|
---
|
|
|
|
|
2020-12-16 00:37:30 -07:00
|
|
|
# --description--
|
2020-09-07 16:17:39 +08:00
|
|
|
|
2020-12-16 00:37:30 -07:00
|
|
|
并不是所有 class 属性都需要有对应的 CSS 样式。有时候我们设置 class 只是为了更方便地在 jQuery 中选中这些元素。
|
2018-10-10 18:03:03 -04:00
|
|
|
|
2020-12-16 00:37:30 -07:00
|
|
|
为每一个 `button` 元素添加 `target` class。
|
2018-10-10 18:03:03 -04:00
|
|
|
|
2020-12-16 00:37:30 -07:00
|
|
|
# --hints--
|
2018-10-10 18:03:03 -04:00
|
|
|
|
2020-12-16 00:37:30 -07:00
|
|
|
给你的每一个 `button` 元素设置 `target` class。
|
2018-10-10 18:03:03 -04:00
|
|
|
|
2020-12-16 00:37:30 -07:00
|
|
|
```js
|
|
|
|
assert($('.target').length > 5);
|
2018-10-10 18:03:03 -04:00
|
|
|
```
|
|
|
|
|
2020-12-16 00:37:30 -07:00
|
|
|
# --solutions--
|
2020-08-13 17:24:35 +02:00
|
|
|
|