DOM Methods
HTMLFormElement.reset()
Restores resettable form controls to their defaults. The cancelable reset event can stop the reset. It does not restore arbitrary attributes such as disabled. Avoid naming a control reset, which can shadow the method. Example result: Ada.
Formal Syntax & Structure
html syntaxhtml
element.reset()Return Value
undefined
No return value.
Working Example
Example Snippethtml
<form id="demo"> <input name="name" value="Ada"></form><p> Result: <output id="result"></output></p><script> const e = document.getElementById('demo'); const result = value => { document.getElementById("result").textContent = String(value); }; e.elements[0].value='New'; e.reset(); result(e.elements[0].value);</script>