The element looks like this:
...
jQuery.attr(\'class\') will return both classes.
jQuery.attr(\'class\')
You need to split that into an array:
console.log(jQuery('selector').attr('class').split(' ')[0]);
var first = jQuery.attr('class').split(" ")[0];
You can use the following to get the first class only from an element:
var firstClass = jQuery('selector')[0].classList[0]