HTMLFormElement:The form Element

The form element is represented by the HTMLFormElement object. It defines the properties and methods shown in the followoing table.

NameDescriptionReturns
acceptCharsetthe accept-charset attributestring
actionthe action attributestring
autocompletethe autocomplete attributestring
enctypethe enctype attributestring
encodingthe enctype attributestring
methodthe method attributestring
nameto the name attributestring
noValidatethe novalidate attributeboolean
targetthe target attributestring
elementsReturns the elements in the formHTMLElement[]
lengthReturns the number of elements in the formnumber
[<name>] Returns the form element with the specified nameHTMLElement
[<index>] Returns the form element at the specified indexHTMLElement
submit()Submits the formvoid
reset()Resets the formvoid
checkValidity()Returns true if all of the form elements pass input validation; returns false otherwiseboolean

The form element defines two special events that are particular to that element.

The form Events

NameDescription
submitTriggered when the form is submitted.
resetTriggered when the form is reset.
Home 
  JavaScript Book 
    DOM