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
12 lines (11 loc) • 380 B
JavaScript
import findUniqueNodeCollection from './findUniqueNodeCollection';
const byName = (name) => 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) {
return findUniqueNodeCollection(names, byName);
}