Advertisement
AviEzerzer

Untitled

Nov 10th, 2019
474
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 0.57 KB | None | 0 0
  1. $(document).ready(function() {
  2.     $(".searchButton").on("click", e => filterSearch());
  3.     $(".searchInput").on("click touchend mouseup mousedown keypress  keyup change blur", e => filterSearch());
  4.  
  5. });
  6.  
  7. function filterSearch() {
  8.     if ($('.searchInput').val().length) {
  9.         var value = $('.searchInput').val().toLowerCase();
  10.         $("[data-search-target]").filter(function() {
  11.             $(this).toggle($(this).attr('data-search-target').toLowerCase().toLowerCase().indexOf(value) > -1)
  12.         });
  13.         return;
  14.     }
  15.     $("[data-search-target]").show();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement