Skip to content

Instantly share code, notes, and snippets.

@raazon
Last active November 24, 2019 07:06
Show Gist options
  • Save raazon/5991f6c193e7449d26f4a096e1109108 to your computer and use it in GitHub Desktop.
Save raazon/5991f6c193e7449d26f4a096e1109108 to your computer and use it in GitHub Desktop.
Reset form fields by JavaScript
// RESET FORM FIELDS BY RAZON
function resetFormFieldsValue(formFields){
for(var count = 0; count < formFields.length; count++) {
formFields[count].value = '';
}
}
var formFields = document.querySelectorAll('.checkout input, .checkout select'); // all input & select fields.
resetFormFieldsValue(formFields);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment