Tuesday, January 14, 2014

// // Leave a Comment

Toggle Two Classes in Jquery - Best way

 Toggle Two Classes in Jquery - Best way

$("#TriggerElement").toggle(function() 
{
        $('#TargerElement').removeClass("FirstClass").addClass("SecondClass"); 

}, function() {
        $('#TargerElement').removeClass("SecondClass").addClass("FirstClass"); 
});
$('#TriggerElement').click(function(){
     $('#TargerElement').toggleClass('FirstClass','SecondClass'); });

0 comments:

Post a Comment