Posted By

reynish on 07/28/10


jquery click toggleClass

Versions (?)

Click toggles multiple classes

 / Published in: jQuery

  1. // Click toggles multiple classes
  2. $('a.jButton').click(function() { // Track click on the button
  3. $('#followUsHover').toggleClass('visible', '200'); // Toggle class and animate
  4. $('a.jButton').toggleClass('jButtonOut', '200'); // Toggle class and animate
  5. });

Report this snippet  


RSS Icon Subscribe to comments
Posted By: reynish on July 28, 2010

There might be a better way of writing this?!?!

Clicking the button causes another E to change class and the button itself.

Posted By: reynish on July 28, 2010

I forgot to add that to animate it will you'll need jQueryUI. If you haven't it won't break just won't animate.

You need to login to post a comment.