Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 950
Sheikhasa Mozali Avatar asked Dec 28 '22 15:12

Sheikhasa Mozali


2 Answers

$('#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

like image 130
thecodeparadox Avatar answered Jan 05 '23 02:01

thecodeparadox


I don't normally help out with this, but I got bored this morning..

http://jsfiddle.net/hHJxP/

like image 33
Jacksonkr Avatar answered Jan 05 '23 01:01

Jacksonkr