Skip to content

Instantly share code, notes, and snippets.

View mnadeem's full-sized avatar

Nadeem Mohammad mnadeem

View GitHub Profile
@searls
searls / tracks_dirty_fields.js
Created April 3, 2012 22:33
A poor man's helper for tracking dirty fields.
var tracksDirtyFields = (function($inputs) {
var inputValue = function($input) {
return $input.is(':checkbox,:radio') ? $input.is(':checked') : $input.val();
},
countFields = function() {
return $(':input').length;
},
readFields = function() {
return _({}).tap(function(values) {
_($(':input')).each(function(input) {