Last active
October 10, 2015 04:48
-
-
Save lucasmezencio/3636314 to your computer and use it in GitHub Desktop.
jQuery 'plugin' to reset a form
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;(function ($, window, document, undefined) { | |
var pluginName = 'reset'; | |
function reset(element) { | |
this.element = element; | |
this._name = pluginName; | |
this.init(); | |
} | |
reset.prototype = { | |
init : function () { | |
this.element.reset(); | |
} | |
} | |
$.fn[pluginName] = function () { | |
return this.each(function () { | |
if (!$.data(this, 'plugin_'+pluginName)) { | |
$.data(this, 'plugin_'+pluginName, new reset(this)); | |
} | |
}); | |
} | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment