Skip to content

Instantly share code, notes, and snippets.

@xbrunosousa
Created November 20, 2019 02:55
Show Gist options
  • Save xbrunosousa/91871e7802f303247f5a7dee382b24d8 to your computer and use it in GitHub Desktop.
Save xbrunosousa/91871e7802f303247f5a7dee382b24d8 to your computer and use it in GitHub Desktop.
Reset form inputs
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<button onclick="reset()">Reset</button>
<form id="teste">
<input />
<input />
<input />
<input />
</form>
</body>
<script>
reset = () => document.getElementById('teste').reset();
</script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment