Skip to content

Instantly share code, notes, and snippets.

@flipflop
Created September 25, 2011 11:30
Show Gist options
  • Save flipflop/1240513 to your computer and use it in GitHub Desktop.
Save flipflop/1240513 to your computer and use it in GitHub Desktop.
Get a class name from multiples
<div id="main" class="style1 style2 style3">
</div>
<script>
console.log(main.className.split(" ")[0]); // first className
console.log(main.className.split(" ")[1]); // second className
console.log(main.className.split(" ")[2]); // third className
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment