HTML <input type=”reset”>
Last Updated :
27 Feb, 2024
HTML <input type=”reset”> defines a button that resets form fields to their default values when clicked, allowing users to clear input data easily.
HTML <input type=”reset”> Syntax:
<input type="reset">
HTML <input type=”reset”> Example:
In this example, we are using a basic implementation of the input reset type.
HTML
<!DOCTYPE html>
< html >
< head >
< title >
HTML Input Type reset
</ title >
</ head >
< body >
< center >
< h1 >GeeksForGeeks</ h1 >
< h2 >HTML Input Type reset</ h2 >
< form action = "/action_page.php" >
< label for = "email" >Enter your email:</ label >
< input type = "email" id = "email" name = "email" >< br >< br >
< label for = "pin" >Enter a PIN:</ label >
< input type = "text" id = "pin" name = "pin" maxlength = "10" >< br >< br >
< input type = "reset" value = "Reset" >
< input type = "submit" value = "Submit" >
</ form >
</ center >
</ body >
</ html >
|
Output:
HTML <input type=”reset”> Example Explanation
- In this example we created a html form with input fields for name and password.
- Includes submit button to send data.
- Add <input type=”reset”> alongside <input type=”submit”>.
- Email and PIN inputs with corresponding labels for user input.
- A reset button provided to clear all form fields when clicked.
- A submit button included to send form data to the specified action URL
HTML <input type=”reset”> Use Cases
To create a reset button in a form using HTML, use the `<input type=”reset”>` element within the <form> tags.
Use the HTML <input type=”reset”> element within a <form> to create a button that resets all form values.
To reset an input type=”file” element using JavaScript/jQuery, set its value to an empty string or use the .val(”) method.
To reset a form using jQuery’s .reset() method, select the form element and call .trigger(‘reset’) or .find(‘:input’).val(”) to reset input values.
HTML <input type=”reset”> Supported Browsers
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...