Skip to content

Commit

Permalink
Update JS snippet
Browse files Browse the repository at this point in the history
  • Loading branch information
mdo committed Jun 24, 2021
1 parent eeef910 commit 1bc82b1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
16 changes: 15 additions & 1 deletion site/content/docs/5.0/components/alerts.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,21 @@ Click the button below to show an alert (hidden with inline styles to start), th
We use the following JavaScript to trigger our live alert demo:

```js
// tbd
var alertPlaceholder = document.getElementById('liveAlertPlaceholder')
var alertTrigger = document.getElementById('liveAlertBtn')

function alert(message, type) {
var wrapper = document.createElement('div')
wrapper.innerHTML = '<div class="alert alert-' + type + ' alert-dismissible" role="alert">' + message + '<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button></div>'

alertPlaceholder.append(wrapper)
}

if (alertTrigger) {
alertTrigger.addEventListener('click', function () {
alert('Nice, you triggered this alert message!', 'success')
})
}
```

### Link color
Expand Down
2 changes: 1 addition & 1 deletion site/content/docs/5.0/components/toasts.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Toasts are as flexible as you need and have very little required markup. At a mi
</div>
{{< /example >}}

### Live
### Live example

Click the button below to show a toast (positioned with our utilities in the lower right corner) that has been hidden by default with `.hide`.

Expand Down

0 comments on commit 1bc82b1

Please sign in to comment.