Arteqo Consulting

The European Web Agency

Design, brand and digital development


×

Arteqo Consulting Services

Contact Arteqo

×
I have read and accept the terms and conditions

button tag

The button tag, which, when implemented in the code, is written like this - <button>, is an HTML tag that belongs to forms and input tags. Form and Input HTML tags are used to create interactive website elements, hence the name of the category. It includes object such as HTML drop-downs, buttons etc.

<button> creates a pressable button element, which then can be used to initiate other actions, much like real-life buttons do. This tag is supported in the current version of HTML, which is HTML5.

Browser support

Here you can see whether <button> is supported by a certain browser, and, if yes, starting from which version it is supported.

Browser support for <button>
ChromeFirefoxEdgeOperaSafari
Is supportedIs supportedIs supportedIs supportedIs supported

Attributes and values

An attribute is a piece of additional information about a tag. While tags denote the type of objects they mark or create, attributes set the parameters of these objects. These parameters can include anything from the types of possible interactions to its visual style to its actual contents.

Values indicate how a certain attribute is actually implemented, if there is a number of ways it can happen.

What attributes are actually allowed in a certain tag depends on the tag itself. Much like possible attributes depend on a tag, possible values depend on an attribute.

The <button> tag supports the following attributes (with their respective values):

AttributeValueDescription
autofocusautofocusSpecifies that a button should automatically get focus when the page loads
disableddisabledSpecifies that a button should be disabled
formform_idSpecifies one or more forms the button belongs to
formactionURLSpecifies where to send the form-data when a form is submitted. Only for type="submit"
formenctype
  • application/x-www-form-urlencoded
  • multipart/form-data
  • text/plain
Specifies how form-data should be encoded before sending it to a server. Only for type="submit"
formmethod
  • get
  • post
Specifies how to send the form-data (which HTTP method to use). Only for type="submit"
formnovalidateformnovalidateSpecifies that the form-data should not be validated on submission. Only for type="submit"
formtarget
  • _blank
  • _self
  • _parent
  • _top
  • framename
Specifies where to display the response after submitting the form. Only for type="submit"
namenameSpecifies a name for the button
  • button
  • reset
  • submit
  • button
  • reset
  • submit
Specifies the type of button
texttextSpecifies an initial value for the button

Global Attributes

Global attributes are HTML tag attributes that can be used by any tag, hence the name "global". They are in contrast to unique attributes that are tag-specific.

<button> supports global attributes.

Event Attributes

Event attributes are HTML tag attributes that allow triggering actions upon specific conditions, hence the name "event". Other types of attributes, namely global and unique attributes, can also trigger actions, but the difference is that even attributes allow calling scripts, such as JavaScript functions, while most other attributes only support a certain type of action.

<button> supports event attributes.