在JQuery中,使用以下代码可轻松隐藏基于预定义列td值的表行。
function filterRows(word){
$('.application>tbody>tr')
.show()
.find('td:nth-child(2)').not(':contains("'+word+'")')
.parent()
.hide()
}
Run Code Online (Sandbox Code Playgroud)
但是,我将如何在多列中显示与td值匹配的行。
类似于以下内容(无效)
function filterRows(word){
$('.application>tbody>tr')
.show()
.find('td:nth-child(2)').not(':contains("'+word+'")')
.find('td:nth-child(3)').not(':contains(30)')
.parent()
.hide()
}
Run Code Online (Sandbox Code Playgroud)
基本上,我只希望在第二列td中仅显示我的单词在“ word”中传递的行,而第三列包含“ 30”。
感谢您的注意。
jquery ×1