return an object with all your elements, where each key is the element's id

npm install getids
2 downloads in the last week
6 downloads in the last month


Returns an object with all DOM nodes by id. It does not return nodes that have no ID. There is one optional argument, either a DOM node, or the ID for a DOM node. If you do not specify one, it will use document

npm install getids


Because I end up writing 20 lines of getElementById when I build interfaces.


given this html

<body><div class="noID"></div><h1 id="title></h1></body>

and this javascript

var getids = require('getids')
var id = getids(document.body)

would yield

id = { title : HTMLElement }
npm loves you