![]() |
VOOZH | about |
The DOM forms collection is used to return the collection of all <form> elements in a HTML document. The form elements are sorted as they appear in the source code.
Syntax:
document.forms
Properties: It returns the number of form in the collection of elements.
Methods: The DOM forms collection contains three methods which are listed below:
Below programs illustrate the use of the documents.forms property in HTML:
Example 1: This example use length property to count number of form elements in the collection.
Output:
Before Click on the button:
After Click on the button:
Example 2:
Output:
Before Click on the button:
After Click on the button:
Example 3:
Output:
Before Click on the button:
After Click on the button:
Supported Browsers: The browser supported by DOM forms collection method are listed below: