Open In App

How to specify the type of button using HTML5 ?

Improve
Improve
Like Article
Like
Save
Share
Report

To specify the button type in HTML5, we can use the HTML | <button> type Attribute. This attribute is used to specify the type of button. It specifies the type attribute of the <button> element. The default types of <button> elements can vary from browser to browser. 

Syntax:

<button type="button|submit|reset">

Example:

HTML




<!DOCTYPE html> 
<html
    <head
        <title
            HTML button type Attribute 
        </title
    </head
      
    <body
        <h1>GeeksforGeeks</h1
          
        <h3>Specifying the Button type</h3
          
        <form action="#" method="get"
            Username: <input type="text" name="uname"
              
            <br><br
              
            Password: <input type="password" name="pwd"
              
            <br><br
              
            <button type="submit" value="submit"
                Submit 
            </button
              
            <button type="reset" value="reset"
                Reset 
            </button
        </form
    </body
</html>                                             


Output:

button type



Last Updated : 31 Mar, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads