nPhoenix

[Get Elements Object]

May 8th, 2012
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. d = document;
  2. $ = {
  3.     id: function (x) {
  4.         return d.getElementById(x);
  5.     },
  6.     class: function (x) {
  7.         return d.getElementsByClassName(x);
  8.     },
  9.     name: function (x) {
  10.         return d.getElementsByName(x);
  11.     }
  12. };
  13. /*
  14. EXs: $.id('lol').innerHTML;
  15. $.class('test')[0].src;
  16. */
Advertisement
Add Comment
Please, Sign In to add comment