reset

Like on, reset also accepts a single event action as input.

The only job of this feature is to restore the element's default value.

Custom elements (e.g. Web Components) can also be made resettable; all they must do is implement the standard reset method.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
<h4 class="mt0">
  Change the value of the input and click the button to restore it.
</h4>

<form on:submit="doReset" reset="doReset">
  <input
    type="text"
    value="edit me"
    class="input"
  >
  <button class="btn mt2">
    click me
  </button>
</form>

Change the value of the input and click the button to restore it.