Skip to content

Instantly share code, notes, and snippets.

@guiliredu
Last active May 8, 2016 18:46
Show Gist options
  • Save guiliredu/f23ee2b793ff37f6f0127ae81905e54b to your computer and use it in GitHub Desktop.
Save guiliredu/f23ee2b793ff37f6f0127ae81905e54b to your computer and use it in GitHub Desktop.
Seach an array of itens for a value and show/hide itens based on ID
$('.js-chat-search').on('keyup', function(){
var s = $(this).val();
if(s != ""){
$('.js-chat-item').hide();
for (var j = 0; j < userList.length; j++) {
if (userList[j][0].toUpperCase().match(s.toUpperCase())){
$('.js-chat-item-'+userList[j][1]).show();
}
}
}else{
$('.js-chat-item').show();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment