Basically this is a filter for wordpress.
All posts are shown in one page and I have added category names as classes to the main div (.box) of a post where one div will have multiple classes.
There are fours drop downs in the filter widget with all the categories listed as options.
I wanted to show only that div which has all the active category names as classes.
Following is the code. With the IF condition, how can I use idea of "AND"?
This code gives me an error.
$('#filter select').change(function()
{
var upper=$('#upper').val();
var sole=$('#sole').val();
var toe=$('#toe').val();
var midsole=$('#midsole').val();
$('.box').each(function()
{
if($(this).hasClass(upper) && hasClass(sole) && hasClass(toe) && hasClass(midsole))
{
$(this).show();
}
else{
$(this).hide();
}
});
});