Skip to content

Instantly share code, notes, and snippets.

@artursopelnik
Created February 1, 2017 12:49
Show Gist options
  • Save artursopelnik/2f1bf8e1ca5594ae57de3cde145035e3 to your computer and use it in GitHub Desktop.
Save artursopelnik/2f1bf8e1ca5594ae57de3cde145035e3 to your computer and use it in GitHub Desktop.
// input[type="reset"] sucks. Do it manually
$(':input', this.form).each(function () {
var type = this.type,
tag = this.tagName.toLowerCase();
if (type == 'text' || type == 'search' || type == 'password' || tag == 'textarea') {
this.value = "";
} else if (type == 'checkbox' || type == '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