Skip to content

Instantly share code, notes, and snippets.

@jafstar
Created October 11, 2013 15:18
Show Gist options
  • Save jafstar/6936517 to your computer and use it in GitHub Desktop.
Save jafstar/6936517 to your computer and use it in GitHub Desktop.
Vanilla JS
//VARS
var $ = document;
var doc = $;
$.id = function(x){
return this.getElementById(x);
}
$.class = function(x){
var e = document.getElementsByTagName('*');
var list = [];
for(var i=0; i < e.length; i++){
if(e[i].className == x){
//DEBUG
//console.log(e[i]);
//PUSH
list.push(e[i]);
}
}
//RETURN
return list;
}
//ONLOAD
$.onload = start();
//START
function start(){
console.log('app started');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment