--- 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
```