I have this code : if you try to click on Button 2 or 3 you can see the right effect.
Now, go back and try to click on Button 1 : nothing happens.
Why? Thanks
$('.navigatorUserButtonOff').click(function(e){
e.preventDefault();
$('.navigatorUserButtons').find('.navigatorUserButtonOn').removeClass().addClass('navigatorUserButtonOff');
$(this).removeClass().addClass('navigatorUserButtonOn');
});
Because when you are attaching the event to
$('.navigatorUserButtonOff')elements, the first button is not within them! So it doesn’t get the event handler.Try this: