HTMLFormElement: reset event

The reset event fires when a <form> is reset.

Bubbles Yes (although specified as a simple event that doesn't bubble)
Cancelable Yes
Interface Event
Event handler property GlobalEventHandlers.onreset

Examples

This example uses EventTarget.addEventListener() to listen for form resets, and logs the current Event.timeStamp whenever that occurs.

HTML

<form id="form">
  <label>Test field: <input type="text"></label>
  <br><br>
  <button type="reset">Reset form</button>
</form>
<p id="log"></p>

JavaScript

function logReset(event) {
  log.textContent = `Form reset! Time stamp: ${event.timeStamp}`;
}

const form = document.getElementById('form');
const log = document.getElementById('log');
form.addEventListener('reset', logReset);

Result

Specifications

Specification
HTML Standard
# event-reset

Browser compatibility

BCD tables only load in the browser

See also