HTML DOM Form Object
Form object
The Form object represents the HTML <form> element.
Access Form object
You can use getElementById() to access the <form> element:
var x = document.getElementById("myForm");
Tip:You can also use forms collection Access <form> element.
Create Form object
You can use the document.createElement() method to create a <form> element:
var x = document.createElement("FORM");
Form object collection
Collection | Description |
---|---|
elements | Return the collection of all elements in the form. |
Form object properties
Properties | Description |
---|---|
acceptCharset | Set or return the value of the accept-charset attribute of the form. |
action | Set or return the value of the action attribute of the form. |
autocomplete | Set or return the value of the autocomplete attribute of the form. |
encoding | Alias of enctype. |
enctype | Set or return the value of the enctype attribute of the form. |
length | Return the number of elements in the form. |
method | Set or return the value of the method attribute of the form. |
name | Set or return the value of the name attribute of the form. |
noValidate | Set or return whether form data should be validated when submitted. |
target | Set or return the value of the target attribute of the form. |
Standard properties and events
The Form object supports both standardPropertiesandEvents.
Related pages
HTML Tutorial:HTML Form
JavaScript Tutorial:JS Form/Validation
HTML Reference Manual:HTML <form> Tag