[jQuery] How to trigger an event/callback if the class(es) of an Element (e.g. div) changes?

[jQuery] How to trigger an event/callback if the class(es) of an Element (e.g. div) changes?


Hello,
is it possible to trigger an event when the class of an Element has
changed?
I have an DIV without any class=""
onclick on that DIV it gets the class="selected"
is it possible to listen to this change and trigger a function to get
all the divs with the class="selected"
I cannot trigger on the click-event because this happens before the
class was added, with the effect that the just clicked DIV is not
counted
thanks in advance
PS: I hope I explained the problem somehow