From af42557f4a8eb69bd098869d0f29f4c456c95063 Mon Sep 17 00:00:00 2001 From: Anton Date: Tue, 16 Mar 2021 08:49:52 +0300 Subject: [PATCH] Update modal's `show` method to accept `relatedTarget` as an argument (#33300) Co-authored-by: Rohit Sharma Co-authored-by: XhmikosR --- site/content/docs/5.0/components/modal.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/site/content/docs/5.0/components/modal.md b/site/content/docs/5.0/components/modal.md index 0abe0ce0f2..0f11614fde 100644 --- a/site/content/docs/5.0/components/modal.md +++ b/site/content/docs/5.0/components/modal.md @@ -892,6 +892,13 @@ Manually opens a modal. **Returns to the caller before the modal has actually be myModal.show() ``` +Also, you can pass a DOM element as an argument that can be received in the modal events (as the `relatedTarget` property). + +```js +var modalToggle = document.getElementById('toggleMyModal') // relatedTarget +myModal.show(modalToggle) +``` + #### hide Manually hides a modal. **Returns to the caller before the modal has actually been hidden** (i.e. before the `hidden.bs.modal` event occurs).