0
我想獲得一個頁面來過濾頁面上的不同參數適合住宿部分。我無法讓過濾器一起工作,所以如果用戶點擊一個部分,它將與另一個部分一起工作。jquery多複選框過濾器
的小提琴是http://jsfiddle.net/ktcle/YEtgM/2/
感謝您的幫助
$('input').change(function(){
$('input').each(function(){
var checked = $(this).attr('checked') || false;
var numberofrooms = $(this).data('bedrooms');
var sitelocation = $(this).data('location');
$('li').each(function(){
if ($(this).data('bedrooms')==numberofrooms){
checked ? $(this).show() : $(this).hide();
}
if ($(this).data('location')==sitelocation){
checked ? $(this).show() : $(this).hide();
}
});
});
});
有什麼理由你的投入沒有名稱和值的屬性? – j08691
沒有理由,這只是在測試,直到它的工作,然後我將它們添加在 –