selecting the first of multiple classes

Posted by gleddy on Stack Overflow See other posts from Stack Overflow or by gleddy
Published on 2010-03-24T13:50:52Z Indexed on 2010/03/24 13:53 UTC
Read the original article Hit count: 261

Filed under:

Not sure if you can do this, but I want to select the first of two classes of an element with jQuery and return it's first class only.

<div class="module blue">

I want to return 'module'.

tried this:

var state = $('body').attr('class').first();

but none of that seems to work, thanks for any advice.

© Stack Overflow or respective owner

Related posts about jQuery