Name

button — HTML 4.01 | HTML5

Synopsis

<button> . . . </button>

Used as part of a form, defines a “button” that functions similarly to buttons created with the input element but allows for richer rendering possibilities. Buttons can contain content such as text and images (but not image maps).

Start/End Tags

Required/Required

Attributes

Core, Internationalization, Events, Focus, HTML5 Global Attributes

autofocus (autofocus="autofocus" in XHTML)

HTML5 only. Indicates the control should have focus (be highlighted and ready for user input) when the document loads.

disabled (disabled="disabled" in XHTML)

Disables the control for user input. It can be altered only via a script. Browsers may display disabled controls differently (grayed out, for example), which could be useful for dimming certain controls until required info is supplied.

form="id of the form owner"

HTML5 only. Explicitly associates the input control with its associated form (its form owner). With this method, the input control does not need to be a child of the form element that applies to it.

formaction="URL"

HTML5 only. Specifies the application that will process the form. It is used only with a submit button (input type="submit") and has the same function as the action attribute for the form element.

formenctype="content type"

HTML5 only. Specifies how the form values are encoded with the post method type. It is used only with a submit button (input type="submit") and has the same function as the enctype attribute for the form element. ...

Get HTML & XHTML Pocket Reference, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.