Monthly Archives: April 2014

Dirty checking to warn for unsaved changes using jQuery

Copy following code snippet into the application. dirtyCount() method return the number of fields have unsaved changes. var dirtyChecking = function () { $(‘input, select, textarea’).each(function () { var ele = $(this); ele.attr(‘data-old’, ele.val()); // Look for changes in the value ele.on(“change keyup paste click”, function (event) { if (ele.attr(‘data-old’) != ele.val()) { ele.addClass(‘unsaved’); }…

Read More