Is there a way in jQuery to loop through or assign to an array all of the classes that are assigned to an element?
ex.
On supporting browsers, you can use DOM elements' classList property.
$(element)[0].classList
It is an array-like object listing all of the classes the element has.
If you need to support old browser versions that don't support the classList
property, the linked MDN page also includes a shim for it - although even the shim won't work on Internet Explorer versions below IE 8.