Skip to content

Instantly share code, notes, and snippets.

@vinzdef
Last active August 29, 2015 14:19
Show Gist options
  • Save vinzdef/b2899da3ed517e20cf92 to your computer and use it in GitHub Desktop.
Save vinzdef/b2899da3ed517e20cf92 to your computer and use it in GitHub Desktop.
function $tag(tag, n){return document.getElementsByTagName(tag)[n]}
function $id(id){return document.getElementById(id)}
function $cl(cl, n){return document.getElementsByClassName(cl)[n]}
function hasClass(className, targetClass){
return (className).match(new RegExp(new RegExp('.*(\\b' + targetClass + '\\b).*')))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment