I try to sort out the members of a team by the function they has in the company.
actually it sorts with an AND function: If member A has function 1 and member B has function 2 and I select the checkboxes for function 1 and for function 2 it will show me member A and member B
but now I need an OR function:
so if member A has function 1 and function 2 and member B has function 2 and I select checkbox for function 1 and for function 2 it should show me only member 1 because he has both functions
Here's my jQuery:
jQuery(document).ready(function($) {
$('div.tags').delegate('input:checkbox', 'change', function()
{
var $lis = $('.results > article').hide();
//For each one checked
var numChecked = $('input:checked').each(function()
{
$lis.filter('.' + $(this).attr('rel')).show();
}).length;
if (!numChecked) $lis.show();
});
});
Here's my HTML:
<section class="squad results">
<article class="function1 function2 function3 ">
<p class="member-name"><b>Member A</b></p>
</article>
<article class="function1">
<p class="member-name"><b>Member B</b></p>
</article>
<article class="function2 ">
<p class="member-name"><b>Member C</b></p>
</article>
</section>
How can I simple change this to sort by OR?
Thanks.
Aucun commentaire:
Enregistrer un commentaire