Open In App

HTML | <button> type Attribute

Last Updated : 20 Jul, 2022
Like Article

The <button> type attribute is used to specify the type of button. It specifies the type attribute of <button> element. The default types of <button> element can vary from browser to browser.


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

Attribute Values:

  • submit: It defines a submit button. It has a default value for all browser except Internet Explorer.
  • button: It defines a clickable button. It has a default value for Internet Explorer.
  • reset: It defines a reset button which is used to change the previous data from the form.



<!DOCTYPE html>
            HTML button type Attribute
        <h3>HTML button type Attribute</h3>
        <form action="#" method="get">
            Username: <input type="text" name="uname">
            Password: <input type="password" name="pwd">
            <button type="submit" value="submit">
            <button type="reset" value="reset">



Supported Browsers: The browser supported by HTML <button> type attribute are listed below:

  • Google Chrome
  • Edge 12
  • Internet Explorer
  • Firefox
  • Safari
  • Opera

Similar Reads

button tag vs input type="button" attribute
The &lt;input type="button"&gt; and &lt;button&gt; tag are two different approach to use Button in HTML document. The difference between them is that the buttons created with the &lt;button&gt; tag offer many contributing possibilities than &lt;input type="button"&gt; attribute. The &lt;button&gt; can have content inside it. The &lt;button&gt; tag
2 min read
Difference between &lt;input type='button' /&gt; and &lt;input type='submit' /&gt;
In HTML, &lt;input&gt; elements are widely used to create various form controls. Two common types of &lt;input&gt; elements used for buttons are &lt;input type='button' /&gt; and &lt;input type='submit' /&gt;. While both appear similar at first glance, they serve different purposes and have distinct behaviors when used in web forms, &lt;input type=
3 min read
How to trigger HTML button after hitting enter button in textbox using JavaScript ?
In this article, we are given an HTML document containing a text area and the task is to trigger the button when the user hit Enter button. We can do it by using the "keyup", "keydown", or "keypress" event listener on the textbox depending on the need. When this event is triggered, we check if the key pressed is ENTER or not. If the key pressed is
4 min read
HTML | DOM Input Button type Property
The DOM Input Button type Property in HTML DOM is used for returning the which type of form element containing the Input Button field is. This Property will always return "Button".Syntax: buttonObject.type Return Values: It returns a string value which represents the type of form element a input button field is. Below program illustrates the use of
1 min read
HTML DOM Button type Property
The Button type Property is used to set or return the value of a type attribute of a &lt;button&gt; element.  Syntax:  It returns the type property.buttonObject.typeIt sets the type property.buttonObject.type = "submit|button|reset"Property Values:  Property Value Description submit It defines a submit button .It has a default value for all browser
2 min read
HTML &lt;input type = "button"&gt;
The HTML &lt;input type="button"&gt; element creates a clickable button that can be customized with text or an image. It does not have any default behavior but can be used to perform actions using JavaScript. It makes versatile for various interactive purposes in web forms and applications. Syntax&lt;input type="button"&gt; Example: In this example
1 min read
HTML &lt;button&gt; value Attribute
The value attribute for &lt;button&gt; element in HTML is used to specify the initial value of the button element. Syntax: &lt;button value = "value"&gt; Example: C/C++ Code &amp;lt;!DOCTYPE html&amp;gt; &amp;lt;html&amp;gt; &amp;lt;head&amp;gt; &amp;lt;title&amp;gt;HTML button value Attribute&amp;lt;/title&amp;gt; &amp;lt;/head&amp;gt; &amp;lt;bod
1 min read
HTML &lt;button&gt; autofocus Attribute
The HTML &lt;button&gt; autofocus Attribute is used to specify whether the button should get automatically get focused or not when the page loads. It is a Boolean Attribute. Syntax: &lt;button type="button" autofocus&gt; Example: This Example illustrates the use of autofocus attribute in Button Element. C/C++ Code &lt;!DOCTYPE html&gt; &lt;html&gt;
1 min read
HTML | &lt;button&gt; form Attribute
The HTML &lt;button&gt; form Attribute is used to specify the one or more forms that the &lt;button&gt; element belongs to. Syntax: &lt;button form="form_id"&gt; Attribute Values: form_id: It Contains the value i.e form_id which specify the one or more than the button element belongs to. The value of this attribute should be id of the &lt;form&gt;
1 min read
HTML | &lt;button&gt; name Attribute
The &lt;button&gt; name attribute is used to specify the name attribute of &lt;button&gt; element. It is used to reference the form-data after submitting the form or to reference the element in a JavaScript. Syntax: &lt;button name="name"&gt; Attribute Values: It contains a single value name which describes the name of the &lt;button&gt; element. E
1 min read