W3Schools.com

HTML <button> type Attribute

HTML button Tag Reference HTML <button> tag

Example

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

<form action="form_action.asp" method="get">
  First name: <input type="text" name="fname" /><br />
  Last name: <input type="text" name="lname" /><br />
  <button type="submit" value="Submit">Submit</button>
  <button type="reset" value="Reset">Reset</button>
</form>

Try it yourself »

Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The type attribute is supported in all major browsers.


Definition and Usage

The type attribute specifies the type of button.

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


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 (clears form-data)


HTML button Tag Reference HTML <button> tag
WEB HOSTING
Best Web Hosting
PHP MySQL Hosting
Best Hosting Coupons
UK Reseller Hosting
Cloud Hosting
Top Web Hosting
$3.98 Unlimited Hosting
Premium Website Design
WEB BUILDING
Download XML Editor
FREE Website BUILDER
Best Website Templates Top CSS Templates
CREATE HTML Websites
EASY WEBSITE BUILDER
W3SCHOOLS EXAMS
Get Certified in:
HTML, CSS, JavaScript, XML, PHP, and ASP
W3SCHOOLS BOOKS
New Books:
HTML, CSS
JavaScript, and Ajax
STATISTICS
Browser Statistics
Browser OS
Browser Display
SHARE THIS PAGE