Javascript Reference
Categories: Element

javascript Element getElementsByTagName( )

@March 15, 2008, 1:22 a.m.
getElementsByTagName( )Firefox/Netscape/NN 6 IE 5 Chrome/Safari/DOM 1  

getElementsByTagName("tagName")

  

Returns an array of all descendant elements of the current element whose tag name matches the parameter of the method. Elements in the array include children, grandchildren, and so on, and are in the source code order. The current element is not included in the array. If there are no matches, the array has a length of zero.

Netscape 6, IE 5/Macintosh, and IE 6/Windows let you specify the quoted asterisk wildcard character as a parameter to return an array of all descendant elements, regardless of tag name. Be aware, however, that different browsers may have slight differences in their document tree structures that result in wildcard parameter array lengths that don't match each other.

 
Parameters
 
  • The (case-insensitive by default) tag name for desired elements. Or an asterisk that acts as a wildcard character to signify all tag names.
 
Returned Value

Array of zero or more element references.


Powered by Linode.