codescracker


html

HTML BUTTON Tag



« Previous Tutorial Next Tutorial »


In HTML, the BUTTON tag is used to add a button control on the form. A button control can be used to perform various tasks, such as submitting or resetting the details of the form.

The BUTTON tag can be used with the conjunction of FORM tag to display the controls on the form. A button control can also be placed on the form by using the INPUT tag, but the difference is that you do not have the scope to change the appearance of the button control, except changing the text on the button control. However, you can change the appearance of the button control in case you have created the button control by using the BUTTON tag.

The button control is created by using the opening and the closing tags of the BUTTON tag. The text, image, or any multimedia embedded between the opening and the closing tags of the BUTTON tag become the content of the button control.

The BUTTON tag provides a type attribute that allows you to create three kinds of button controls i.e. submit button, reset button, and normal button. The submit button is used to submit the form, whereas the reset button is used to erase all the text entered in the text box of the form and set the default values.

The submit button is created by setting the type attribute to submit, the reset button is created by setting the type attribute to reset, and the normal button is created by setting the value of the type attribute to button.

Attributes of the BUTTON tag

The following table describes the various attributes of the BUTTON tag :

Attribute Description
autofocus Allows the button control to get the focus as soon as page loads
disabled Disables the button control
form Refers to the id of the FORM tag
formaction Refers to the value of the action attribute of the current form
formenctype Specifies a value that is used to encode the content while submitting to the server. The possible values are application/x-www-form-urlencoded (default), multipart/form-date, text/plain
formmethod Specifies the methods of the HTTP at the time of the submitting the button control. The possible values are get, post, put, and delete
formnovalidate Specifies that the form is not to validate at the time of submitting the button control
formtarget Specifies the destination, such as a new tab or a new window, to load the browsing context
name Provides a name of the button control
type Specifies the type of the button control. The possible values are submit, reset, and button
value Provides a value to the button control. You can use this attribute if the form attribute is present

« Previous Tutorial Next Tutorial »



Tools
Calculator

Quick Links
Signup - Login - Give Online Test