Home > Abakada: Back to Basics > Language References > HTML Elements > INPUT type=button Element
HTML Input Elements
Creates a button control. | HTML 2, 3.2, 4, 4.01, 5 |
HTML Syntax
<input
accesskey = key
class = classname
datafld = fieldname
dataformatas = html | text
datasrc = #id
dir = ltr | rtl
disabled
id = value
name = name
size = n
style = css_style_rules
tabindex = n
title = text
type = submit
value = value
>
The INPUT type=button element renders a push button on an HTML form. The text to be displayed in the button is specified thru its value attribute.
<input type="button" value="Click me">
Push buttons have no default behavior. Each push button may have client-side scripts associated with the element’s event attributes, to make the button perform an action when an event occurs, such as when the user presses the button, releases it, etc.
Note that authors can create push buttons with the BUTTON element as well, that offers richer rendering capabilities than the INPUT element.
NOTE: Only the <input
> start tag must be present. The element has no end tag.
The <input_button>
element has no attribute of its own, but supports global attributes common to all HTML elements.
In most cases, a script is used to make the button perform an action when the user clicks the button. This is done by specifying any ECMAScript-compliant statement or function call as the value of the button's onclick event attribute. When the event occurs, the associated script is triggered.
<form>
<input type="button" value="Say Hello"
onclick="alert ( 'Hello' )">
</form>
BUTTON, INPUT