Open In App

How to specify the type of button using HTML5 ?

Last Updated : 31 Mar, 2021
Comments
Improve
Suggest changes
Like Article
Like
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

Next Article

Similar Reads