May 2011 Entries
I dug up one of my first jQuery plugins and thought I would share. //thomas gathings //jquery plugin to enable confirmation of unsaved changes on common input elements. //apply to an ancestor, such as fieldset, div, or form. jQuery.fn.confirmUnsavedCha... = function() { var $obj = this; var saving = false; window.onbeforeunload = function() { //if local element data 'dirty' = true, show unload confirmation if (!saving && $obj.data("dirty")) { return "You have unsaved changes."; } }; //for...