Skip to Content
NFSFU234FormValidation v3 is here — file upload validation, config-driven rules, and more.

reset

The reset function resets the values of all form elements (inputs, textareas, and selects) within a specified form. If no form is provided, it defaults to the document’s body. It can handle form elements specified by an ID, an HTMLFormElement, or an HTMLDivElement.

Works in: React JS, HTML5

ParameterTypeDefaultDescription
formHTMLFormElement | HTMLDivElement | string | nullnullThe form element, its ID, or null to use the document body.

Usage

Example: Reset Form Elements

const formId = "myForm"; nfsfu234FormValidation.reset(formId); // Resets the form with ID 'myForm' const formElement = document.getElementById('myForm'); nfsfu234FormValidation.reset(formElement); // Resets the form element directly

See also

Last updated on