Change Class Of Links With Default Values With Jquery
I have three links on which I manually set classes: One defaults to .active and the others default to .inactive. I have some jQuery that I'm using to toggle the class of the links
Solution 1:
If I do get you correct, your selector is too strict: handling only the inactive
links.
Tried the following?
$(function(){
var sidebar=$('#sidebar');
sidebar.delegate('a', 'click',function(){
sidebar.find('.active').toggleClass('active inactive');
$(this).addClass('active').removeClass('inactive');
});
});
Post a Comment for "Change Class Of Links With Default Values With Jquery"