Created
April 23, 2014 12:43
-
-
Save fentas/11213785 to your computer and use it in GitHub Desktop.
simple jquery autocompletion / list filter
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
/* | |
<input > | |
<ul> | |
<li text="test">test</li> | |
<li text="foo">foo value</li> | |
</ul> | |
*/ | |
$('input').keyup(function(e) { | |
var ul = $(this).next(); | |
ul.find('> li:visible').hide().end().find('> li[text*="' + $(this).val() + '"]').show(); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment