From: Anton Date: Tue, 16 Mar 2021 05:49:52 +0000 (+0300) Subject: Update modal's `show` method to accept `relatedTarget` as an argument (#33300) X-Git-Tag: v5.0.0-beta3~31 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=af42557f4a8eb69bd098869d0f29f4c456c95063;p=thirdparty%2Fbootstrap.git Update modal's `show` method to accept `relatedTarget` as an argument (#33300) Co-authored-by: Rohit Sharma Co-authored-by: XhmikosR --- 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).