jQuery plugin to check for unsaved changes before leaving a page.
Download and estract the files to your project, and include:
<script type="text/javascript" src="path/jquery.min.js"></script>
<script type="text/javascript" src="path/jquery.areYouSure.min.js"></script>
$ bower install jquery.areYouSure --save
Method | Description |
---|---|
reload |
Method to reinitialise the script, and refresh the pre-stored data. |
remove |
Unbind/remove listener from element(s) |
// Bind to all form elements
$('form').areYouSure();
// Bind to form elements except those with class a and/or b
$('form').areYouSure({except: '.a, .b'});
// Bind to specific element(s) with class
$('.element-with-class').areYouSure();
$('form').areYouSure({
warningText: 'You have made unsaved changes. Are you sure you want to leave?'
});
$('form').areYouSure('reload');
$('form').areYouSure('remove');