Never been to TextSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

Generic Fast $(), getEl() (See related posts)

// Generic Fast $(), getEl() R.E.M
// e= id, element, array of..
// returns element or [] of elements

function getEl(e) {  
  if (typeof e == 'string') 
    {return window.document.getElementById(e);}  
  if (e[0]) {//array
    var i=e.length;     
    while(i--) {e[i]=arguments.callee(e[i]);}
    return e;}  return e;//element
}

You need to create an account or log in to post comments to this site.


Related Posts