jQuery has a .filter
method. I would also recommend that you store the restaurant object with the div using .data
to store the restaurant name and type with its div:
$(".restaurants > div").filter(function(){
var info = $(this).data("info");
// Some code to extract things like spicyness, expensiveness
// Also some code to get the slider values...
if (spicynessSliderValue <= spicyness && expensivenessSliderValue <= expensiveness)
{
return true;
}
}).show();
In your case I would suggest using $.each
however:
$(".restaurants > div").each(function(){
...
var isMatch = picynessSliderValue <= spicyness && expensivenessSliderValue <= expensiveness;
$(this).toggle(isMatch); // like .show or .hide, but takes a boolean
})