Name
Submit — a button to submit a form
Availability
JavaScript 1.0; enhanced in JavaScript 1.1
Inherits from/Overrides
Inherits from Input, HTMLElement
Synopsis
form
.name
form
.elements[i
]form
.elements['name
']
Properties
Submit inherits properties from Input and HTMLElement and defines or overrides the following:
-
value
A read-only string that specifies the text that appears within the Submit button. It is specified by the
value
attribute of the<input>
tag that created the button. If novalue
attribute is specified, the defaultvalue
is
“Submit Query” or some similar string in the browser’s default language. In browsers that cannot reflow document content, this property may be read-only.
Methods
Submit inherits methods from Input and HTMLElement.
Event Handlers
Submit inherits event handlers from Input and HTMLElement and defines or overrides the following:
-
onclick
Invoked when the Submit button is clicked.
HTML Syntax
A Submit object is created with a
standard HTML <input>
tag:
<form> ... <input type="submit" // Specifies that this is a Submit button [ value="label
" ] // The text that is to appear within the button // Specifies the value property [ name="name
" ] // A name you can use later to refer to the button // Specifies the name property [ onclick="handler
" ] // JavaScript statements to be executed when the button // is clicked > ... </form>
Submit objects can also be created with the
HTML 4
<button>
tag:
<button id="name
" type="submit" value="value
" onclick="handler
">label ...
Get JavaScript: The Definitive Guide, Fourth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.