I have a form with multiple fields on a page. If a user fills in the fields and then decides to leave the page he/she will loose it. I’d like to add an alert using jQuery UI dialog to alert them about the data that has not been saved. I think I can get the buttons and dialog figured out. My question is: how do I detect them leaving the page without submitting the form?
Share
Here is a quick example – you need to be able to detect whether the form has been submitted as part of an onbeforeunload event.