I'm trying to add a period "." and the suffix "-on" to a variable (line 4 below):
function globalProducts(cat, self){
$("div.info").hide();
$(self).addClass(cat+'-on');
$(".product-stats li :not('.'+cat+'-on')").removeClass();
}
$("li.stat-cat1 a").live('click', function() {
globalProducts('stat-cat1',this);
$(".ingredients").show();
return false;
});
The code lints but it doesn't work in practice. Something is wrong. Any ideas?
Thanks!
Look at the syntax highlighting:
$(".product-stats li :not('.'+cat+'-on')").removeClass();
Your quotes are wrong, it should be:
$(".product-stats li :not(." + cat + "-on)").removeClass();
.