mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-28 15:50:01 +02:00
Add js-docs shortcode to ensure consistency between doc and js code (#38316)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
This commit is contained in:
@@ -38,28 +38,7 @@ 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
|
||||
const alertPlaceholder = document.getElementById('liveAlertPlaceholder')
|
||||
|
||||
const alert = (message, type) => {
|
||||
const wrapper = document.createElement('div')
|
||||
wrapper.innerHTML = [
|
||||
`<div class="alert alert-${type} alert-dismissible" role="alert">`,
|
||||
` <div>${message}</div>`,
|
||||
' <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>',
|
||||
'</div>'
|
||||
].join('')
|
||||
|
||||
alertPlaceholder.append(wrapper)
|
||||
}
|
||||
|
||||
const alertTrigger = document.getElementById('liveAlertBtn')
|
||||
if (alertTrigger) {
|
||||
alertTrigger.addEventListener('click', () => {
|
||||
alert('Nice, you triggered this alert message!', 'success')
|
||||
})
|
||||
}
|
||||
```
|
||||
{{< js-docs name="live-alert" file="site/assets/js/snippets.js" >}}
|
||||
|
||||
### Link color
|
||||
|
||||
|
Reference in New Issue
Block a user