The element looks like this:
<li class="blah active"> ... </li>
jQuery.attr('class') will return both classes. How can I get only the 1st class ('blah' in this case) with jQuery?
jQuery.attr('class')
You need to split that into an array:
split
console.log(jQuery('selector').attr('class').split(' ')[0]);
1.4m articles
1.4m replys
5 comments
57.0k users