What closed a foundation modal in closed event?

Using Foundation 5 modal dialogs. Is there a way to pass what fired the close event. Like a button or a link? Something like this. I tried using the data attribute but that doesn’t seem to work.

$('#cancelbutton').on('click',function() { 
     $('#mymodal').foundation('reveal','closed',{data:'cancelbutton'});
});
$(document).on('closed.fndtn.reveal', '[data-reveal]', function (e) {
     var closer = e.data;
});


Source: jquery

Leave a Reply