Sunday 30 October 2022

How we can create search filter on same page

 <script>

     $("#search-text").keyup(function() {

    var str = $(this).val(); /* Get the value of the textbox */

const arr = str.split(" ");

for (var i = 0; i < arr.length; i++) {

    arr[i] = arr[i].charAt(0).toUpperCase() + arr[i].slice(1);


}

const str2 = arr.join(" ");

    $(".arm_download_wrapper").show(); /* Show all .subcat-item */

    $(".arm_download_description p").filter(function() { /* Filter all .item and hide*/

      return !$(this).text().includes(str2);

    }).parent().parent().hide();

  });

});    

</script>

No comments:

Post a Comment