Posted By

almazom on 02/13/10


Tagged

javascript selector


Versions (?)

$ selector


 / Published in: JavaScript
 

  1. function $() {
  2. var elements = new Array();
  3. for (var i = 0; i < arguments.length; i++) {
  4. var element = arguments[i];
  5. if (typeof element == 'string')
  6. element = document.getElementById(element);
  7. if (arguments.length == 1)
  8. return element;
  9. elements.push(element);
  10. }
  11. return elements;
  12. }

Report this snippet  

You need to login to post a comment.