Revision: 4793
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at January 21, 2008 11:14 by stiki101
Initial Code
function $() { var elements = new Array(); for (var i = 0; i < arguments.length; i++) { var element = arguments[i]; if (typeof element == 'string') element = document.getElementById(element); if (arguments.length == 1) return element; elements.push(element); } return elements; } // Sample Usage: var obj1 = document.getElementById('element1'); var obj2 = document.getElementById('element2'); function alertElements() { var i; var elements = $('a','b','c',obj1,obj2,'d','e'); for ( i=0;i
Initial URL
Initial Description
instead of document.getElementById('a');, you’d simply just do this instead: $('a');. And if you wanted a whole collection of elements, you can simply do this: $('a','b',obj,obj2,'c','d');
Initial Title
Prototype function $
Initial Tags
Initial Language
JavaScript