The HTMLFormElement.reset()
method restores a form element's default values. This method does the same thing as clicking the form's reset button.
If a form control (such as a reset button) has a name or id of reset
it will mask the form's reset method. It does not reset other attributes in the input, such as disabled
.
Syntax
HTMLFormElement.reset()
Example
document.getElementById('myform').reset();
Specifications
Specification | Status | Comment |
---|---|---|
HTML Living StandardThe definition of 'HTMLFormElement: reset' in that specification. | Living Standard |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
reset
|
Chrome
Full support 1 |
Edge
Full support 12 |
Firefox
Full support 1 |
IE
Full support 9 |
Opera
Full support 8 |
Safari
Full support 3 |
WebView Android
Full support 1 |
Chrome Android
Full support 18 |
Firefox Android
Full support 4 |
Opera Android
Full support 10.1 |
Safari iOS
Full support 1 |
Samsung Internet Android
Full support 1.0 |
Legend
- Full support
- Full support
HTMLFormElement.reset() by Mozilla Contributors is licensed under CC-BY-SA 2.5.