Created
February 26, 2016 01:10
-
-
Save microdesign/48369e067fcad95bfe08 to your computer and use it in GitHub Desktop.
jQuery easy lists filter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var $products = $('.list li'); | |
$('#filter').keyup(function() { | |
var re = new RegExp($(this).val(), "i"); // "i" means it's case-insensitive | |
$products.show().filter(function() { | |
return !re.test($(this).text()); | |
}).hide(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment