Submit and Reset Buttons in HTML

A submit button is used to send the form data to a web server. When submit button is clicked the form data is sent to the file specified in the form's action attribute to process the submitted data. A reset button resets all the forms control to default values. We can create submit and reset button using <input> tag by setting its type attribute to submit or reset. Example :
<!DOCTYPE html>
<html>
   <head>
   <title>Submit and Reset Button</title>
   </head>
   <body>
     <form action="/action_page.php">
        First name: <input type="text" name="firstname" />
        Last name: <input type="text" name="lastname">
        <input type="submit" value="Submit"> <input type="reset" value="Reset">
     </form>
   </body>
</html>
The output of above code will be :


Attributes :

  • submit : This creates a button that automatically submits a form.
  • reset : This creates a button that automatically resets form controls to their initial values.
  • value : This can be used to provide an initial value inside the control.



Next Topic :