Last active
May 8, 2016 18:46
-
-
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
This file contains 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
$('.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