Last active
December 12, 2015 04:38
-
-
Save BernardoSilva/4715627 to your computer and use it in GitHub Desktop.
jQuery basic logic for a search as the user type
This file contains hidden or 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
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