Opens in a new tab
A picture of Jeff Brigman
I CODE TODAY FOR
A BETTER TOMORROW

Glossary Term

HTMLCollection.namedItem()

3 tags 1 category

The namedItem() method of the HTMLCollection interface returns the first Element in the collection whose id or name attribute match the specified name, or null if no element matches.

In JavaScript, instead of calling collection.namedItem(“value”), you can also directly access the name on the collection, like collection[“value”], unless the name collides with one of the existing HTMLCollection properties.

Inputs: key A string representing the value of the id or name attribute of the element we are looking for.

Returns: The first Element in the HTMLCollection matching the key, or null if there is none. Always returns null if key is the empty string.

Term Connections

Explore related terms connected by shared tags, shared categories, and relationship phrases. This map loads only when it comes into view.

Loading term connections…