I come back to show some progress on How to warn the user that all unsaved changes will be lost when he is leaving the page. This is my current implementation.
1 //Version 0.1
2 //April 10 2011 22:54
3 //Julian Vargas
4 //http://gr8code.blogspot.com
5 (function () {
6 var userIsEditing = false;
7 var message = "Do you really want to abandon this page?, unsaved changes will be lost."
8
9 $("a").click(function (event) {
10 if (userIsEditing)
11 if (!confirm(message))
12 event.preventDefault();
13 });
14
15 $(":input, :text, :password, :radio, :checkbox").bind("keyup", function () {
16 userIsEditing = true;
17 });
18
19 })();
No comments:
Post a Comment