Could you recommend some lightweight jQuery plugin to detect if fields specified by selector have changed?
E.g. like this one on SO, showing confirmation dialog when I want to reload page during post edition.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This is too basic/specific a functionality to likely have its own plugin.
All you need to do is store a boolean value that gets set to true if any element is changed:
Edit: previous use of
onbeforeunloadwas incorrect. See this page for more details on its usage.