getElementsByTagName method

HTMLCollection getElementsByTagName(
  1. String qualifiedName
)

The Element.getElementsByTagName() method returns a live HTMLCollection of elements with the given tag name.

All descendants of the specified element are searched, but not the element itself. The returned list is live, which means it updates itself with the DOM tree automatically. Therefore, there is no need to call Element.getElementsByTagName() with the same element and arguments repeatedly if the DOM changes in between calls.

When called on an HTML element in an HTML document, getElementsByTagName lower-cases the argument before searching for it. This is undesirable when trying to match SVG elements (such as <linearGradient>) in an HTML document. Instead, use Element.getElementsByTagNameNS, which preserves the capitalization of the tag name.

Element.getElementsByTagName is similar to Document.getElementsByTagName, except that it only searches for elements that are descendants of the specified element.

Implementation

external HTMLCollection getElementsByTagName(String qualifiedName);