bootstrap how to detect which button closed a modal dialog on 'hidden_modal_bs' event func?
bootstrap-modal, events, twitter-bootstrap-3
Solution
Instead of `hidden.bs.modal`, have a look at `hide.bs.modal`, which is fired before the dialog is closed.
And instead of looking at e, try looking at `document.activeElement` (like `document.activeElement.innerText`, or `document.activeElement.id`).
Problem
I have a welcome type bootstrap-modal on homepage that shows three buttons, each one of them should load different pages Here it is a relevant excerpt of the HTML ``` <div class="modal fade" id="welcomeModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" > <div class="modal-dialog" > <div class="modal-content" ;"> <div class="modal-header"> <h3 class="modal-title" id="ModalLabel">Welcome to Here</h3> </div> <div class="modal-body" style='height: 90.5%;'> <span style="display:td;text-align;center;">Blah Blah BLah</span> </div> <div class="modal-footer"> <div class="btn-group"> <a id='taketour' class="btn btn-default btn-lg" data-dismiss="modal" ,aria-hidden="true" href="/tour">Take a tour</a> <a id='register' class="btn btn-default btn-lg" data-dismiss="modal" aria-hidden="true" href="/add">Register</a> <a id='login' class="btn btn-default btn-lg" data-dismiss="modal" aria-hidden="true" href="/login">Login</a> </div> </div> </div> </div> </div ``` And here my JS ``` $(window).load(function(){ $('#welcomeModal').modal('show'); }); $('#welcomeModal').on('hidden.bs.modal', function (e) { if (e.id == 'taketour') { $(window).location=e.href; } if (e.id == 'login') { $('#welomeModal').remote='element-login'; } }); ``` (Note: This JS obviously doesn't work. It's just my last attempt) So , the question is: How can I find which button has been pressed from inside the `hidden.modal.bs` function ?