Skip to content

Instantly share code, notes, and snippets.

@fentas
Created April 23, 2014 12:43
Show Gist options
  • Save fentas/11213785 to your computer and use it in GitHub Desktop.
Save fentas/11213785 to your computer and use it in GitHub Desktop.
simple jquery autocompletion / list filter
/*
<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