Skip to content

Instantly share code, notes, and snippets.

@walterdavis
Created September 27, 2010 03:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save walterdavis/598565 to your computer and use it in GitHub Desktop.
Save walterdavis/598565 to your computer and use it in GitHub Desktop.
var list = $$('#yourBox li');
list.each(function(elm){
elm['keys'] = elm.innerHTML.stripTags().toLowerCase();
});
var lastValue = $F("filter");
$('filter').observe('keyup', function(e) {
var value = this.value.toLowerCase();
if (value !== lastValue) {
list.each(function(elm) {
if (elm.keys.include(value)) {
elm.show();
}else{
elm.hide();
}
});
lastValue = value;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment