Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MINOR Added destroy() method to jQuery.changetracker plugin

  • Loading branch information...
commit 0b6d45356ebb9a55f07eb2834e0aab19227f4b2a 1 parent 6c1f799
@chillu chillu authored
Showing with 10 additions and 2 deletions.
  1. +10 −2 admin/javascript/jquery-changetracker/lib/jquery.changetracker.js
View
12 admin/javascript/jquery-changetracker/lib/jquery.changetracker.js
@@ -67,8 +67,8 @@
// setup original values
var fields = this.getFields();
- fields.filter(':radio,:checkbox').bind('click', onchange);
- fields.not(':radio,:checkbox').bind('change', onchange);
+ fields.filter(':radio,:checkbox').bind('click.changetracker', onchange);
+ fields.not(':radio,:checkbox').bind('change.changetracker', onchange);
fields.each(function() {
var origVal = $(this).is(':radio,:checkbox') ? self.find(':input[name=' + $(this).attr('name') + ']:checked').val() : $(this).val();
$(this).data('changetracker.origVal', origVal);
@@ -76,6 +76,14 @@
this.data('changetracker', true);
};
+
+ this.destroy = function() {
+ this.getFields()
+ .unbind('.changetracker')
+ .removeClass(options.changedCssClass)
+ .removeData('changetracker.origVal');
+ this.removeData('changetracker');
+ };
/**
* Reset change state of all form fields and the form itself.
Please sign in to comment.
Something went wrong with that request. Please try again.