A cross-browser implementation of getElementsByClass. Heavily based on Dustin Diaz's function: http://dustindiaz.com/getelementsbyclass.
Uses default getElementsByClassName
if it's available.
Built to be used with the Component package manager. Read more here:
$ component install javve/get-by-class
var getByClass = require('get-by-class');
var menu = document.getElementById('menu');
// Returns set of items
var activeItem = getByClass(menu, 'active');
// Returns single item
var activeItem = getByClass(menu, 'active', true);
Find all elements with class className
inside container
.
Use single = true
to increase performance in older browsers
when only one element is needed.
MIT