Introducing jQuery.dirty

Introducing jQuery.dirty

Having previously blogged about checking if a form has been modified I needed something slightly different

I came across dirrty, a jQuery plugin by Ruben Torres that I personally found to have a cleaner implementation than the dirtyFields I previously wrote about.

For instance, to check if a form has unsaved changes is a lot simpler

// dirtyFields
var isFormDirty1 = $.fn.dirtyFields.getDirtyFieldNames($form).length > 0;

// dirrty
var isFormDirty2 = $form.dirrty("isDirty");

Dirrty did most of what I wanted to do but I still needed to extend it further.
And so, jQuery.dirty was born.Check out for more. Take a look at the code here

It contains a few extra commands, including

var isFormDirty = $form.dirty("isDirty");

var isFormClean = $form.dirty("isClean");



To take it for a test drive you can either use git, bower or npm

git clone
bower install jquery.dirty
npm install jquery.dirty

Share Tweet Send