隐藏没有特定类别的表格行 [英] Hide table rows that don't have a certain class

查看:92
本文介绍了隐藏没有特定类别的表格行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

function filterRows(statusName) {
    $("#mainTable tbody tr."+statusName).hide();
}

它隐藏具有名为statusName的类的行.如何只隐藏没有一行的行?

It hides the rows that have the class called statusName. How do I hide only the rows that don't have one?

推荐答案

:not()选择器

$("#mainTable tbody tr:not(."+statusName + ')').hide();

这篇关于隐藏没有特定类别的表格行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆