you would imagine this would be easy to implement, but oh well..
anyway, I have an element to which classes are added or removed based of interaction on the site.
In jQuery:
if($("#mydiv").is('[class]')
As YoYo points it out in comment, this would failed if attribute class as an empty string set. So don't use it...