jQuery - Search image title attribute

前端 未结 5 2018
天涯浪人
天涯浪人 2021-01-24 01:38

I have been looking at this jQuery quick filter code here: https://github.com/syropian/jQuery-Quick-Filter

I\'d like to be able to use it to quick filter a list of image

5条回答
  •  一整个雨季
    2021-01-24 02:13

    without quickfilter

    $('#txtSearch').keyup(function (e) {
        var query = $(this).val().toLowerCase();
        $('#list img').each(function (index) {
            if ($(this).attr('title').toLowerCase().indexOf(query) == -1) {
                $(this).hide();
            } else {
                $(this).show();
            }
        });
    });
    

提交回复
热议问题