I have made a fiddle illustrating the issue I am facing at the moment. So every time I close and open a modal, shown.bs.modal also fires multiple times. In this
shown.bs.modal
Define variable and set it's value to 1; like:
function openTestModal(){ $('#testModal').modal({ keyboard: false, backdrop: 'static' }); var e=1; $('#testModal').on('shown.bs.modal', function (e) { alert(''); e=0; }); }