Name
HTMLDocument.getElementsByName( ): find elements with the specified name attribute — DOM Level 2 HTML
Synopsis
Element[] getElementsByName(StringelementName);Arguments
-
elementName The desired value for the
nameattribute.
Returns
A read-only array (technically a NodeList) of Element
objects that have a name
attribute with the specified value. If no such elements are found,
the returned array is empty and has a length of 0.
Description
This method searches an HTML document tree for Element nodes
that have a name attribute of the
specified value and returns a NodeList (which you can treat as a
read-only array) containing all matching elements. If there are no
matching elements, a NodeList with length 0 is returned.
Do not confuse this method with the Document.getElementById( ) method, which
finds a single Element based on the unique value of an id attribute, or with the Document.getElementsByTagName( ) method,
which returns a NodeList of elements with the specified tag
name.
See Also
Document.getElementById( ),
Document.getElementsByTagName(
)
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access