Advertisement
Guest User

Untitled

a guest
Aug 19th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. $("#filter").keyup(function() {
  2.  
  3. console.log("keyup");
  4. // Retrieve the input field text and reset the count to zero
  5. var filter = $(this).val(),
  6. count = 0;
  7.  
  8. // Loop through the comment list
  9. $('.row .base div').each(function() {
  10.  
  11.  
  12. // If the list item does not contain the text phrase fade it out
  13. if ($(this).text().search(new RegExp(filter, "i")) < 0) {
  14. $(this).hide(); // MY CHANGE
  15.  
  16. // Show the list item if the phrase matches and increase the count by 1
  17. } else {
  18. $(this).show(); // MY CHANGE
  19. count++;
  20. }
  21.  
  22. });
  23.  
  24. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement