Skip to content

Instantly share code, notes, and snippets.

@justinclayton
Created August 29, 2012 16:59
Show Gist options
  • Save justinclayton/3515615 to your computer and use it in GitHub Desktop.
Save justinclayton/3515615 to your computer and use it in GitHub Desktop.
expanded from coffeescript
$(document).ready(function() {
var search_box;
search_box = $('#search');
return search_box.bind('keyup', function() {
var items;
items = $('.item_link');
return items.each(function() {
var item, query;
query = $('#search').val();
item = $(this);
if (query.length === 0) {
return item.show();
} else if (item.text().indexOf(query) === -1) {
return item.hide();
}
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment