Skip to content

Instantly share code, notes, and snippets.

@pascalmaddin
Created January 28, 2014 07:57
Show Gist options
  • Save pascalmaddin/8663741 to your computer and use it in GitHub Desktop.
Save pascalmaddin/8663741 to your computer and use it in GitHub Desktop.
Here is a little snippet if you're trying to check wether element contains a class, without using jQuery. From http://sonnyt.com/javascript-check-if-element-has-class/
function hasClass(element, className) {
return element.className && new RegExp("(^|\\s)" + className + "(\\s|$)").test(element.className);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment