Skip to content

Instantly share code, notes, and snippets.

@danmatthews
Created March 6, 2012 10:51
Show Gist options
  • Save danmatthews/1985665 to your computer and use it in GitHub Desktop.
Save danmatthews/1985665 to your computer and use it in GitHub Desktop.
$('#search-input').die('keyup').live('keyup', function() {
var SearchTermVariable = $('#search-input').val().toString().toLowerCase();
if($.trim(SearchTermVariable) == '') {
$('ul#group-contact-list li').show();
} else {
$('ul#group-contact-list li label').each(function() {
var labelText = $(this).text().toString().toLowerCase();
if( labelText.indexOf(SearchTermVariable) != -1 ) {
$(this).closest('li').show(); // Match
} else {
$(this).closest('li').hide(); // No match
}
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment