Collection of HTML elements.
Platform Support
| IE | Mozilla | Netscape | Opera | Safari | Chrome | no | 1.0+ | 6.0+ | 7.0+ | no | no |
|---|
Constructors
| Constructor | Action | IE | Mozilla | Netscape | Opera | Safari | Chrome | ||
|---|---|---|---|---|---|---|---|---|---|
|
HTMLCollection Constructor() : HTMLCollection
Collection of HTML elements.
|
Show Details | no | 1.0+ | 6.0+ | 7.0+ | no | no | ||
HTMLCollection() : HTMLCollectionCollection of HTML elements. Returns
|
|||||||||
Properties
| Property | Action | IE | Mozilla | Netscape | Opera | Safari | Chrome |
|---|---|---|---|---|---|---|---|
|
length
: Number
Number of elements in the collection.
|
Show Details | no | 1.0+ | 6.0+ | 7.0+ | no | no |
|
|||||||
Functions
| Method | Action | IE | Mozilla | Netscape | Opera | Safari | Chrome | |||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
item(Number index) : Node
Returns the element found at the specified position in the collection.
|
Show Details | no | 1.0+ | 6.0+ | 7.0+ | no | no | |||||
|
Parameters
Returns
|
||||||||||||
|
namedItem(String name) : Node
Returns the element with the specified Id.
|
Show Details | |||||||||||
|
Parameters
Returns
|
||||||||||||
Remarks
Use the item method to return an element by index position. Use the namedItem method to return an
element by its name.
References
Availability
HTML DOM Level 2|W3C