Skip to content Skip to sidebar Skip to footer
Reading Time: < 1 minute

How can you clear or reset large fields of form quickly.You can use jquery $('#formID').reset();. But this would remain in the form if you reset it this way.This is why a “manual” reset is needed.
This is the perfect way to clear large or small or any form using jquery.

.not(':button, :submit, :reset, :hidden')


Also you can use following function and call to it for clear the form by passing form ID or name as parameter.

function resetForm($form) {
    $form.find('input:text, input:password, input:file, select, textarea').val('');
    $form.find('input:radio, input:checkbox')
// How to call:
resetForm($('#YourFormID')); // by id, recommended
resetForm($('form[name=myName]')); // by name


You can use following simple method to clear form.

// Use a whitelist of fields to minimize unintended side effects.
$('INPUT:text, INPUT:password, INPUT:file, SELECT, TEXTAREA', '#myFormId').val('');
// De-select any checkboxes, radios and drop-down menus
$('INPUT:checkbox, INPUT:radio', '#myFormId').removeAttr('checked').removeAttr('selected');