简体   繁体   中英

How can I make quicksearch use multiple criteria?

I have the quicksearch plugin for jquery working on an input, to allow a table to be filtered:

$('input#table-filter').quicksearch('table tbody tr');

However, I would now like to make an adjustment whereby a user can type in multiple criteria (eg using a text area, with each term on a separate line), and the filter shows all rows that match any of the criteria.

It appears as though all you have to do is add an option to it.

$('#table-filter').quicksearch('table tbody tr',{ 
    prepareQuery: function(val){
        return val.toLowerCase().split('\n');
    }
});

https://github.com/riklomas/quicksearch/blob/master/jquery.quicksearch.js#L24

this causes it to split the input value on new line rather than space.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM