Created by: scottkf
I was in the situation of having a modal with an 'ok' and 'cancel' button and needed to figure out which caused the modal to close.
I needed the event info that was passed to the Modal.hide()
function to be passed to the hide
and hidden
events as well. So now I can do this:
$('#modal-from-dom').bind('hidden', function(e, f) {
if ($.inArray("cancel",f.srcElement.classList) < 0) {
// some stuff
}
});
Given these elements:
<a href="#" class="close btn primary">Ok</a>
<a href="#" class="close cancel btn secondary">Cancel</a>