Is there a way to put the default popup warning in the bootstrap modal when changing a page if there are unsaved changes on the current page?
My code below shows the bootstrap modal but after showing the modal, it will still go to another page without clicking on the modal. When I tried putting return, it does not work.
function checkUnsaved() {
if (unsaved == true) {
$('#unsavedConfirm').modal({ backdrop: 'static', keyboard: false });
$("#unsavedConfirm").modal('show');
}
}
$(window).bind('beforeunload', function () {
checkUnsaved();
});