AI Workshop: learn to build apps with AI →
File APIs: Reset a form

Join the AI Workshop and learn to build real-world apps with AI. A hands-on, practical program to level up your skills.


A common need is to reset a form to its initial state. You can use a reset button or call reset() from JavaScript.

A reset button is an <input type="reset" />:

<input type="reset" />

To reset a form from JavaScript, get the form element and call reset():

const form = document.querySelector('form')
form.reset()

This restores all form fields to their initial values.

Lessons in this unit:

0: Introduction
1: The File object
2: FileList
3: FileReader
4: Blob
5: FormData
6: Accept only images in file input
7: Check if checkbox is checked
8: ▶︎ Reset a form
9: File upload with server handling
10: Drag and drop file upload
11: Validating file size before upload