jQuery check if Attr Class exists?

Viewed 39443

How do I determine if the .attr('class') exists?

I am using this code:

if(jQuery(this).attr('class') != undefined && jQuery(this).hasClass('myclass')) {
  //Do something
}

It doesn't seem to work.

5 Answers
Related