UNPKG

vanillajs-browser-helpers

Version:

Collection of convenience code snippets (helpers) that aims to make it a little easier to work with vanilla JS in the browser

18 lines (11 loc) 422 B
import findUniqueNodeCollection from './findUniqueNodeCollection'; const byName = (name: string) => document.getElementsByName(name); /** * Find DOM elements with the given name * * @param names - Value of name attribute to find the elements by * @return List of found DOM elements */ export default function findByName(names: string | string[]): Element[] { return findUniqueNodeCollection(names, byName); }