this below code is working correctly but i want alert of javascript one not windows alert.
unsaved = false;
$(":input").change(function () {
unsaved = true;
});
$(document).on("submit", "form", function (event) {
unsaved = false;
$(window).off('unload');
});
function unloadPage() {
if (unsaved) {
return "You have unsaved changes on this page. Do you want to leave page?";
}
}
window.onbeforeunload = unloadPage;