/ Published in: jQuery

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
$("#filter").keyup(function () { var filter = $(this).val(), count = 0; $(".filtered:first li").each(function () { if ($(this).text().search(new RegExp(filter, "i")) < 0) { $(this).addClass("hidden"); } else { $(this).removeClass("hidden"); count++; } }); $("#filter-count").text(count); });
URL: http://www.mattryall.net/blog/2008/07/jquery-filter-demo
Comments
