Jquery 筛选表

Jquery 筛选表,jquery,filter,html-table,Jquery,Filter,Html Table,我正在创建一个带有表格的原型网站。我只是想知道如何过滤表格内容?例如,我有两个按钮,分别是“writer”和“illustrators”,当我单击writer按钮时,我只希望表格只显示writer 是否可以使用表行id类对其进行筛选 比如: 无名氏 1980年1月1日 jondoe@domain.com 无名氏 1980年9月1日 janedoe@domain.com 梅尔·史密斯 1980年8月1日 meeeeel@domain.com 哈里史密斯 1980年12月1日 hsmith@dom

我正在创建一个带有表格的原型网站。我只是想知道如何过滤表格内容?例如,我有两个按钮,分别是“writer”和“illustrators”,当我单击writer按钮时,我只希望表格只显示writer

是否可以使用表行id类对其进行筛选

比如:


无名氏
1980年1月1日
jondoe@domain.com
无名氏
1980年9月1日
janedoe@domain.com
梅尔·史密斯
1980年8月1日
meeeeel@domain.com
哈里史密斯
1980年12月1日
hsmith@domain.com

或者有什么简单的方法可以做到这一点

你在找类似的东西吗

jQuery(function () {
    $('#illustrator').click(function () {
        $('table tr.writer').hide();
        $('table tr.illustrator').show();
    })
    $('#writer').click(function () {
        $('table tr.writer').show();
        $('table tr.illustrator').hide();
    })
})

演示:

见,谢谢@阿伦普约翰尼:)
jQuery(function () {
    $('#illustrator').click(function () {
        $('table tr.writer').hide();
        $('table tr.illustrator').show();
    })
    $('#writer').click(function () {
        $('table tr.writer').show();
        $('table tr.illustrator').hide();
    })
})