The following code is something i got together and its not really doing what i need it to do.
I'm trying to get exact match results .. If i clicked Internet and Telephone it should only show exactly what i click on. if i clicked on 1 it should show one and if i clicked on all 3 it should only show all three..
Code:<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"> </script> <script type="text/javascript"> $(document).ready(function(){ $('div.tags').delegate('input:checkbox', 'change', function() { var $lis = $('.results > li').fadeOut(); //For each one checked $('input:checked').each(function() { $lis.filter('.' + $(this).attr('rel')).fadeIn(); }); }); }); </script>
HTML Code:<div class="tags"> <label><input type="checkbox" rel="internet" /> Internet </label> <label><input type="checkbox" rel="telephone" /> Telephone</label> <label><input type="checkbox" rel="television" /> Television</label> </div> <ul class="results"> <li class="internet"> Internet </li> <li class="telephone"> Telephone </li> <li class="television"> Television </li> <li class="internet telephone television"> Internet / Telephone / Television </li> <li class="television internet"> Television / Internet </li> <li class="television telephone"> Television / Telephone </li> </ul>



Reply With Quote





Bookmarks