Name
Form
Synopsis
document.forms[form_number]document.forms[form_name]document.form_name
Properties
The Form object defines properties for each of the attributes of
the HTML <form> element, such
as action, encoding, method, name, and target. In addition, it defines the
following properties:
elements[ ]A read-only array of Input objects representing the elements that appear in the form. The array can be indexed numerically, or by element name for elements that have HTML
nameattributes defined.lengthThe number of elements in the form. Equivalent to
elements.length.
Methods
reset( )Resets each of the input elements of the form to their default values. Returns nothing. JS 1.1.
submit( )Submits the form, but does not trigger the
onsubmitevent handler. Returns nothing.
Event Handlers
onresetInvoked just before the elements of the form are reset. Return
falseto prevent reset.onsubmitInvoked just before the form is submitted. This event handler allows form entries to be validated before being submitted. Return
falseto prevent submission.
See Also
Element, Input, Select, Textarea
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access