0% found this document useful (0 votes)
146 views

HTML Button Type Attribute

This document discusses the HTML <button> type attribute. The type attribute specifies the type of button, with options including "button", "submit", and "reset". An example is provided showing two buttons in a form - one submit button and one reset button. The type attribute is important for buttons as different browsers may use different default types, and it is always recommended to specify the type. Browser support for the attribute is shown to be consistent across all major browsers.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
146 views

HTML Button Type Attribute

This document discusses the HTML <button> type attribute. The type attribute specifies the type of button, with options including "button", "submit", and "reset". An example is provided showing two buttons in a form - one submit button and one reset button. The type attribute is important for buttons as different browsers may use different default types, and it is always recommended to specify the type. Browser support for the attribute is shown to be consistent across all major browsers.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

30/11/22, 12:32 HTML button type Attribute

Dark code
  HTML CSS   
 Menu  Log in

HTML <button> type Attribute


❮ HTML <button> tag

Example
Two button elements that act as one submit button and one reset button (in a form):

<form action="/action_page.php" method="get">

  <label for="fname">First name:</label>

  <input type="text" id="fname" name="fname"><br><br>

  <label for="lname">Last name:</label>

  <input type="text" id="lname" name="lname"><br><br>

  <button type="submit" value="Submit">Submit</button>

  <button type="reset" value="Reset">Reset</button>

</form>

Try it Yourself »

Definition and Usage


The type attribute specifies the type of button.

Tip: Always specify the type attribute for the <button> element. Different browsers
may use different default types for the <button> element. Dark mode

https://www.w3schools.com/tags/att_button_type.asp
D k d 1/7
30/11/22, 12:32 HTML button type Attribute
Dark code
  HTML CSS   
Browser Support
Attribute

type Yes Yes Yes Yes Yes

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

Attribute Values
Value Description

button The button is a clickable button

submit The button is a submit button (submits form-data)

reset The button is a reset button (resets the form-data to its initial
values)

❮ HTML <button> tag

ADVERTISEMENT

Dark mode

https://www.w3schools.com/tags/att_button_type.asp
D k d 2/7

You might also like