Skip to content

Instantly share code, notes, and snippets.

@BernardoSilva
Last active December 12, 2015 04:38
Show Gist options
  • Save BernardoSilva/4715627 to your computer and use it in GitHub Desktop.
Save BernardoSilva/4715627 to your computer and use it in GitHub Desktop.
jQuery basic logic for a search as the user type
function filter_users_dropdown() {
search = $('#from').val().toLowerCase();
$('#users-dropdown li').each(function(index) {
var value = $(this).text().toLowerCase();
n = value.search( search );
if(n>=0) {
$(this).show();
} else {
$(this).hide();
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment