--- id: bad87fee1348ce8acef08814 title: 使用 btn-danger 提示危险操作 challengeType: 0 forumTopicId: 18375 dashedName: warn-your-users-of-a-dangerous-action-with-btn-danger --- # --description-- Bootstrap 有着丰富的预定义按钮颜色。 红色 `btn-danger` class 用来提醒用户此行为具有破坏性,比如删除一张猫的图片。 创建一个带有文本 `Delete` 的按钮,给它设置 class `btn-danger`。 注意:这些按钮仍然需要 `btn` 和 `btn-block` class。 # --hints-- 应创建一个新的带有文本 `Delete` 的 `button` 元素。 ```js assert(new RegExp('Delete', 'gi').test($('button').text())); ``` 所有 Bootstrap 按钮的 class 属性都应该包含 `btn` 和 `btn-block`。 ```js assert($('button.btn-block.btn').length > 2); ``` 新创建按钮的 class 属性应该包含 `btn-danger`。 ```js assert($('button').hasClass('btn-danger')); ``` 确保所有的 `button` 元素都有一个闭合标签。 ```js assert( code.match(/<\/button>/g) && code.match(/

Things cats love:

Top 3 things cats hate:

  1. flea treatment
  2. thunder
  3. other cats
``` # --solutions-- ```html

CatPhotoApp

Click here for cat photos.

A cute orange cat lying on its back. Three kittens running towards the camera.

Things cats love:

Top 3 things cats hate:

  1. flea treatment
  2. thunder
  3. other cats
```