[jQuery] Multiple classes selector causing trouble, but why ??
Hi all,
i'm struggling with a small yet in,teresting problem. In order to
allow users to filter content, i've created a small checkbox list. To
each checkbox is attached an ID , and too some divs on the page are
attached these id's too (in the class attr that is); one div can be
attached to multiple id's, and so have multiple classes.
In order to show or hide my div's I wrote :
function couponsVisibles(){
$('.checkInteret').each(function(){
var coche = $(this).attr("checked");
if (coche) {
var idCoupons = $(this).attr("id");
$(".zoneCoupon , div[class='" +idCoupons+ "']").each(function(){
$(this).fadeIn();
});
}
});
}
$(".checkInteret").click(function(){
var coche = $(this).attr("checked");
if (!coche) {
var idCoupons = $(this).attr("id");
$(".zoneCoupon , div[class='" +idCoupons+ "']").each(function(){
$(this).fadeOut();
});
}
couponsVisibles();
});
It looks like my selector "$(".zoneCoupon , div[class='" +idCoupons+
"']")" doesn't work, but I can't figgure out why.
Oh, and, btw, I've started using the [attribute*=value] selector, but
this selector doesn't seem to make a difference beetween class='8 10'
and class='8 1'...
Help really appreciated, thx !!