mirror of
https://github.com/tenrok/bootstrap.git
synced 2026-06-14 18:42:30 +03:00
Use a streamlined way to trigger component dismiss (#34170)
* use a streamlined way to trigger component dismiss * add documentation Co-authored-by: XhmikosR <xhmikosr@gmail.com>
This commit is contained in:
@@ -204,17 +204,7 @@ See the [triggers](#triggers) section for more details.
|
||||
|
||||
### Triggers
|
||||
|
||||
Dismissal can be achieved with `data` attributes on a button **within the alert** as demonstrated above:
|
||||
|
||||
```html
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||
```
|
||||
|
||||
or on a button **outside the alert** using the `data-bs-target` as demonstrated above:
|
||||
|
||||
```html
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" data-bs-target="#my-alert" aria-label="Close"></button>
|
||||
```
|
||||
{{% js-dismiss "alert" %}}
|
||||
|
||||
**Note that closing an alert will remove it from the DOM.**
|
||||
|
||||
|
||||
Reference in New Issue
Block a user