Home  »  HTML   »   button

An element used for interaction. The button is a container element.

name

name of the control. This becomes request name when form is submitted

  • Text without spaces
type

defines type of the button.

  • submit: Submits the form. This is a default feature of the button
  • reset: Resets the controls within the form to its default values
  • button: Does nothing. This is mainly used to add javascript interaction
value

Used when form is submitted the submitted data will have a button value in the data

  • Text
disabled

Disables the form control.

  • None
autofocus

Sets focus to the control. This can be used only once per form

  • None
form

It associates the control to a form element. If absent, the control will be associated to its form ancestor.

  • Value of a form element's id attribute.
formaction

This will override a form element's action attribute. It defines the address where submitted data should be sent.

  • URL
formmethod

Will override a form element's method attribute. Is changes the HTTP method by which submitted form data should be sent.

  • get: This method is used for simple data sending, such as search queries. The data is visible in the URL
  • post: This method sends data with an Invisible HTTP request. This method is more secure and the date sending limit can be extended by server configuration.
formenctype

Defines the MIME type used to encode the form data

  • application/x-www-form-urlencoded: Default encoding not encryption.
  • text/plain: Basic text encoding.
formnovalidate

Indicates that the form should not be validated before it is submitted

  • None

HTML Button Example:

Edit Example