Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*Case Insensitive search for text*/
  2. $.expr[':'].icontains = function(obj, index, meta, stack){ 
  3.     return (obj.textContent || obj.innerText || jQuery(obj).text() || '').toLowerCase().indexOf(meta[3].toLowerCase()) >= 0; 
  4. };
  5.  
  6. $('#search').bind('keyup change',function(ev){
  7.     $('li').show();
  8.  
  9.     var searchTerm = $(this).val();
  10.     if(searchTerm){
  11.         $('li').not('li:icontains("' + searchTerm + '")').hide();
  12.     }
  13. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement