My aim is to write an event which will trigger if given element will get a class, or when this class would be removed.
Let's say I have:
<button id="my_butt_show">showtime</button>
<button id="my_butt_hide">hide me</button>
<span id="the_changer"></span>
<span id="the_end">some text</span>
<script>
// this is the part of code I can't edit!
$('#my_butt_show').click( function() {
$('the_changer').addClass('hiMom');
});
$('#my_butt_hide').click( function() {
$('the_changer').removeClass('hiMom');
});
</script>
Now I would like something like this:
<script>
$("#the_changer").onClassAdd('hiMom', $("#the_end").display('true') );
$("#the_changer").onClassRemove('hiMom', $("#the_end").display('false') );
</script>
Does jQuery (or js itself maybe?) have something like this?
Note - of course this is just an example, the real thing I'm dealing with is harder and while here I could use some simpler solution, in my main task it wouldn't work.
Thx for responses.
----edit----
After first answers: I don't have access to the part of code where ".click" or "addClass" is, so I can't just do my stuffs there.