Skip to content

Instantly share code, notes, and snippets.

@ThomasHambach
Created March 19, 2013 04:33
Show Gist options
  • Save ThomasHambach/5193734 to your computer and use it in GitHub Desktop.
Save ThomasHambach/5193734 to your computer and use it in GitHub Desktop.
Get first classname using jQuery.
<a id="myelement" href="http://google.com" class="class1 class2 class3">Go to google</a>
<script>
$('a#myelement').attr('class').split(' ')[0];
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment