I am wanting to intercept anchor clicks and show a prompt if text has changed and not been submitted in a form using zebra-dialog. For any other form of page leaving I use the built in browser unload dialog.
Here is the code I have so far, the dialog shows, but no matter which option you click you end up staying on the page.
$("body").on("mousedown",'a', function(e) {
if(inputhaschanged) {
return $.Zebra_Dialog("You haven't submitted your comment. Do you wish to leave?", {'type':'question','title':'','buttons': [
{caption: 'No', callback: function() { }},
{caption: 'Yes', callback: function() { return true; }}]
});
}
});