if class changed than do ....

if class changed than do ....

Hello,
i need a solution for this:

if('#myelement').hasClass('myClass'){ do anything }

This would only be checked at the Loading of the page, but the class will be added through javascript. How to solve this?

And i can't write a setTimeout because the "do anything" plays a video". I need a solution like "if changed or .live ?!

thank you