根据复选框和数据元素隐藏/显示表行

我想隐藏表格中的行,因为我选中了复选框,表格中的数据元素不正确。

  • 另一个实验

:我还可以使用数据元素和下拉列表进行排序,查看tr标签(价格,名称,评级)?

Price: Low to High Price: High to Low Store Rating AZ ZA
COD: YES EMI: No Return Policy: 30 days Price: 45000 Discount : 300
COD: YES EMI: No Return Policy: 30 days Price: 42000 Discount : 300
COD: NO EMI: YES Return Policy: 30 days Price: 48000 Discount : Not Available
COD: YES EMI: YES Return Policy: 30 days Price: 45000.50 Discount : Not Avaialable

jQuery的

 $(".filter-list").change(function(){ $("#productsprice").children('tbody').children('tr').each(function(){ var match = false; $(this).attr('data-cod').each(function() { if($(this).text() == $(".filter-list").val()) match = true; }); // if data tag in  found as not 1(true). toggle the hidden class to that rows and so on for each rows }); }); 

小提琴: http //jsfiddle.net/9TTPS/9/

无需重新发明轮子。 如果你想要真正的表过滤/排序function,你应该使用像SlickGrid或jqGrid这样的网格库