Dofactory.com
Dofactory.com

HTML <input> type="button"

An <input> tag with a type="button" attribute creates a clickable button.

These buttons are commonly used to execute JavaScript.

Example

#

An <input> element of type button.
Clicking the button displays an alert box.

<input type="button" 
       value="Start calculations"
       onclick="alert('Calculations have been started!')">

Using input type="button"

The <input type="button"> tag creates a clickable button.

Input element of this type are mostly used to execute JavaScript functions.


Syntax

<input type="button">

Browser support

Here is when type="button" support started for each browser:

Chrome
1.0 Sep 2008
Firefox
1.0 Sep 2002
IE/Edge
1.0 Aug 1995
Opera
1.0 Jan 2006
Safari
1.0 Jan 2003

You may also like

 Back to <input>

Author: Jack Poorte
Published: Jun 20 2021
Last Reviewed: Sep 30 2023


What's your favorite/least favorite part of Dofactory?


Guides