11.2. The collection features provided by the DOM

11.2.1. Collecting page elements by name

The getElementsByName() is our first function to collect and to gain access to a group of elements. We have used it in previous chapters and it is time now to study it in more detail from a data structure point of view. The formal declaration of the getElementsByName() function is

   NodeList getElementsByName(DOMString elementName)

This function takes a string elementName as argument and searches the entire document. It returns a collection of elements that matches the elementName. To use this function, you need to understand the return type NodeList. The type NodeList is actually an object with data and functions. The definition of NodeList is given by ...

Get Practical Web Technologies now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.