I have a function corresponding to the unload event in my form:
window.onbeforeunload = function() {
return "Your work will be lost.";
};
This function works every time the page is refreshed. However I want that the function should not be executed when the user submits the form. How can I do this using Javascript or JQuery ?