Filter cards in Bootstrap 4 with jQuery

时光怂恿深爱的人放手 提交于 2019-12-02 21:25:37

Here's a quick example of how you could do it using jQuery's contains selector:

$('.searchbox-input').change( function () {
    $('.card').show();
    var filter = $(this).val(); // get the value of the input, which we filter on
    $('.container').find(".card-title:not(:contains(" + filter + "))").parent().css('display','none');
});

Currently this is set up to happen on change of the search input, you would probably want set up a submit button and have it fire on submit instead.

Bootply Example

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!