Dollar G
This method is for "$Group" which returns a collection of elements (an array) no matter what you pass it: a DOM element, an id that references one, a selector, or an array of elements. This is useful if you want to have a class that accepts as it's arguments any number of elements. It always returns an array, though it may be empty.
$G('div'); //all the divs on the page

$G(document.getElementsByTagName('div')); //all the divs on the page

$G('logo'); //the logo at the top of the page; [$('logo')];

var logo = $('logo'); $G(logo); //the logo at the top of the page; [logo]

cnet-libraries/04.1-utilities/02-dollarg.txt · Last modified: 2009/03/19 17:04 by artefact