Skip to content Skip to sidebar Skip to footer

Toggle .active Class With Jquery

I'm trying to toggle the class .active with jquery, heres what I've got so far: html

Solution 1:

In your initEvents function you can look for and remove all active classes on your buttons excluding the clicked button. That should give you the functionality your looking for.

initEvents : function() {
  var obj = this;

  obj.dd.on('click', function(event){
    $('.active').not($(this)).removeClass('active');
    $(this).toggleClass('active');
    event.stopPropagation();
  });
}

http://jsfiddle.net/UhSqd/1/

Post a Comment for "Toggle .active Class With Jquery"