No problem. btw you can simplify further if you wish...
function toggleMode(mediaType) { $.each(['.video', '.music', '.radio'], function(n, v){ $(v)[(mediaType == n+1 ? 'add' : 'remove')+'Class']('active'); }); } On Nov 23, 9:01 am, [EMAIL PROTECTED] wrote: > Hey Wizzud. Thanks for your help - I figured it out. You're right - there was > no reason to use the toggleClass function in this case. The addClass and > removeClass were the way to go. It totally makes sense now - I'm just adding > the "active" class to whatever existing class I need. This is very helpful! > Here is my final code sample: > > function toggleMode(mediaType) { > // reset all tabs > > $(".music").removeClass("active");$(".video").removeClass("active");$(".radio").removeClass("active"); > // set active > if (mediaType == "1") $(".video").addClass("active"); > else if (mediaType == "2") $(".music").addClass("active"); > else if (mediaType == "3") $(".radio").addClass("active"); > > } >