san650 / to_read

Simple app to keep track of unread links (web resources)
1 stars 0 forks source link

Search/Filter capability #16

Open hidnasio opened 11 years ago

hidnasio commented 11 years ago

As a reader,

I want to be able to start writing in a text-box and the list of resources gets updated to only display the items with the text I'm writing.

san650 commented 11 years ago

Something like this? (use the customization option to test the javascript)

$('.content ul').parent().prepend($("", { id: 'search' })); $('#search').keydown(function(){ var term = $.trim($(this).val()); if(term.length > 0) { term = new RegExp(term, 'i'); $('.content li').show().each(function(i, n) { if(!term.test(n.textContent)) { $(n).hide(); } }); } else { $('.content li').show(); } });