Skip to content

Instantly share code, notes, and snippets.

@mlimaloureiro
Last active August 29, 2015 13:59
Show Gist options
  • Save mlimaloureiro/10916613 to your computer and use it in GitHub Desktop.
Save mlimaloureiro/10916613 to your computer and use it in GitHub Desktop.
var $searchbox = $('#quick-search'); // selector do input
var $listElement = $('.list-element'); // selector para os elementos da lista
$searchbox.keyup(function() {
var e = $(this).val(),
t = 0,
n = 0;
$listElement.each(function() {
if ($(this).text().search(new RegExp(e, "i")) < 0) {
$(this).hide()
} else {
$(this).show();
t++
}
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment