Skip to content

Instantly share code, notes, and snippets.

@lucasmezencio
Last active October 10, 2015 04:48
Show Gist options
  • Save lucasmezencio/3636314 to your computer and use it in GitHub Desktop.
Save lucasmezencio/3636314 to your computer and use it in GitHub Desktop.
jQuery 'plugin' to reset a form
;(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