HTML Input Control Elements Button


<input type="button" value="Button Text">

Buttons can be used for triggering actions to occur on the page, without submitting the form. You can also use the <button> element if you require a button that can be more easily styled or contain other elements:

<button type="button">Button Text</button>

Buttons are typically used with an "onclick" event:

<input type="button" onclick="alert('hello world!')" value="Click Me">


<button type="button" onclick="alert('hello world!')">Click Me</button>



The name of the button, which is submitted with the form data.


The type of the button.

Possible values are:

submit : The button submits the form data to the server. This is the default if the attribute is not specified, or if the attribute is dynamically changed to an empty or invalid value.

reset : The button resets all the controls to their initial values.

button : The button has no default behavior. It can have client-side scripts associated with the element's events, which are triggered when the events occur.

menu : The button opens a popup menu defined via its designated element.


The initial value of the button.


Extra Attributes for Submit Buttons

formSpecifies the ID of the form the button belongs to.
If none is specified, it will belong to its ancestor form element (if one exists).
formactionSpecifies where to send the form-data
when the form is submitted using this button.
formenctypeSpecifies how the form-data should be encoded
when submitting it to the server using this button.
Can only be used with formmethod="post".
formmethodSpecifies the HTTP method to use (POST or GET)
when sending form-data using this button.
formnovalidateSpecifies that the form-data should not be validated on submission.
formtargetSpecifies where to display the response that is received
after submitting the form using this button.