How to get Bootstrap Modal invoke or source element?
$('#your-modal').on('show.bs.modal', function (e) {var $invoker = $(e.relatedTarget);
});
Various events of modal popup are:
- show.bs.modal: fired just before the modal is open.
- shown.bs.modal: fired after the modal is shown.
- hide.bs.modal: fired just before the modal is hidden.
- hidden.bs.modal: fired after the modal is closed.
How to open a Bootstrap modal window using jQuery?
$('#myModal').modal('show') // initializes and invokes show immediately
Bootstrap has a few functions that can be called manually on modals:
$('#myModal').modal('toggle');
You can check more documentation here
https://getbootstrap.com/docs/3.4/javascript/
$('#myModal').modal('show');
$('#myModal').modal('hide');