I am working with jquery input checkbox filter. While I am searching for the reference I got the following code from 'StackOverflow' that works perfectly. But my problem is how to use this code with logical and operation. ie, if I checked two checkboxes, it only displays content with both value, not either or
$(document).ready(function () {
$('.post').show();
$('.menu-item').find('input:checkbox').on('click', function () {
var post = $('.post').hide();
var elements = $('.menu-item').find('input:checked');
if(elements.length){
elements.each(function () {
post.filter('.' + this.id).show();
});
}
else
post.show();
});
});
Aucun commentaire:
Enregistrer un commentaire