HTMLFormElement:The form Element
The form element is represented by the HTMLFormElement object. It defines the properties and methods shown in the followoing table.
Name | Description | Returns |
---|---|---|
acceptCharset | the accept-charset attribute | string |
action | the action attribute | string |
autocomplete | the autocomplete attribute | string |
enctype | the enctype attribute | string |
encoding | the enctype attribute | string |
method | the method attribute | string |
name | to the name attribute | string |
noValidate | the novalidate attribute | boolean |
target | the target attribute | string |
elements | Returns the elements in the form | HTMLElement[] |
length | Returns the number of elements in the form | number |
[<name>] | Returns the form element with the specified name | HTMLElement |
[<index>] | Returns the form element at the specified index | HTMLElement |
submit() | Submits the form | void |
reset() | Resets the form | void |
checkValidity() | Returns true if all of the form elements pass input validation; returns false otherwise | boolean |
The form element defines two special events that are particular to that element.
The form Events
Name | Description |
---|---|
submit | Triggered when the form is submitted. |
reset | Triggered when the form is reset. |