Skip to content

Instantly share code, notes, and snippets.

@hmert
Created October 15, 2010 08:32
Show Gist options
  • Save hmert/627851 to your computer and use it in GitHub Desktop.
Save hmert/627851 to your computer and use it in GitHub Desktop.
/*
jQuery Form resetleyici
*/
$.fn.clearForm = function () {
return this.each(function () {
$('input,select,textarea', this).clearFields();
});
};
$.fn.clearFields = $.fn.clearInputs = function () {
return this.each(function () {
var t = this.type,
tag = this.tagName.toLowerCase();
if (t == 'text' || t == 'password' || tag == 'textarea') this.value = '';
else if (t == 'checkbox' || t == 'radio') this.checked = false;
else if (tag == 'select') this.selectedIndex = -1;
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment