Filter cards in Bootstrap 4 with jQuery

后端 未结 3 1364
闹比i
闹比i 2021-02-03 15:07

I am attempting to create a page that is populated by many cards, using bootstrap 4\'s new card component.

I want to create a search bar, that when searched, filters ou

3条回答
  •  走了就别回头了
    2021-02-03 15:59

    Here is the simple solution.

    $(document).ready(function(){
      $('.searchbox-input').on("keyup", function() {
        var value = $(this).val().toLowerCase();
        $(".card").filter(function() {
          $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
        });
      });
    });
    
    

提交回复
热议问题