javascriptfilterjqueryjquery-effects

How to build a simple table filter with jQuery?


How can I build a simple table filter with good effect using jQuery? I don't mind about pagination.

list -> select data of database.

I do not want to use a plugin, I prefer the use of short code.

Example: Table Filter With JQuery


Solution

  • $('#inputFilter').keyup(function() {
        var that = this;
        $.each($('tr'),
        function(i, val) {
            if ($(val).text().indexOf($(that).val()) == -1) {
                $('tr').eq(i).hide();
            } else {
                $('tr').eq(i).show();
            }
        });
    });
    

    CHECH THIS