Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add note about cancelling modal events to modal.md #38411

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
7 changes: 7 additions & 0 deletions site/content/docs/5.3/components/modal.md
Original file line number Diff line number Diff line change
Expand Up @@ -868,4 +868,11 @@ const myModalEl = document.getElementById('myModal')
myModalEl.addEventListener('hidden.bs.modal', event => {
// do something...
})

myModalEl.addEventListener('hide.bs.modal', event => {
// you can also abort the event...
if (!valid) {
return event.preventDefault()
}
})
```
Loading