$(document).ready(function () {
$("#filter").keyup(function () {
// Retrieve the input field text and reset the count to zero
var filter = $(this).val(),
count = 0;
// Loop through the comment list
$("li").each(function () {
// If the list item does not contain the text phrase fade it out
if ($(this).text().search(new RegExp(filter, "i")) < 0) {
$(this).fadeOut(0).addClass('hidden');
// Show the list item if the phrase matches and increase the count by 1
} else {
$(this).show().removeClass('hidden');
count++;
}
});
// Update the count
var numberItems = count;
$("#filter-count").text("Number of Comments = " + count);
});
});
$(document).ready(function () {
$('.studentList > li.' + $(this).attr('rel')).show();
$('div.tags').find('input:checkbox').live('click', function () {
if($('div.tags').find('input:checkbox:checked').length > 0){
$('.studentList > li').hide();
$('div.tags').find('input:checked').each(function () {
$('.studentList > li.' + $(this).attr('rel')).not('.hidden').show();
});
} else {
$('.studentList > li').not('.hidden').show();
}
});
});
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.