jquery toggleClass With Condition

Toggle class using jquery if else statement


$('input[type=radio][name=RadioGroup1]').change(function () {
     $('.test').toggleClass("classGreen", this.value == 'Y');
     $('.test').toggleClass("classRed", this.value != 'Y');
 });
DEMO
jquery toggleClass With Condition jquery toggleClass With Condition Reviewed by Bhaumik Patel on 8:10 PM Rating: 5