如何使用jquery检查TR是否包含具有特定CSS类的TD? [英] How to check if a TR contains a TD with a specific CSS class with jquery?
本文介绍了如何使用jquery检查TR是否包含具有特定CSS类的TD?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我知道您可以使用.find
查找td:contains('text')
,但是如果我说的是tr,则3 td,而其中一个tem的 might 可能是class="specialclass someotherclass"
(可能除了特殊类以外的其他类),如何使用jquery检查TR是否包含specialclass
的TD?
I know you can use .find
to find td:contains('text')
, but if I have a tr with say, 3 td's, and one of the td's might have class="specialclass someotherclass"
(may potentially have other classes in addition to special class), how do I use jquery to check if a TR contains a TD of specialclass
?
推荐答案
要选择具有td.specialclass
的任何tr
:
$('tr:has(td.specialclass)')
或者如果您有tr
(用this
表示),而您只是想检查它是否具有这样的td
:
Or if you have a tr
(represented by this
) and you simply want to check if it has such a td
:
if ($(this).find('td.specialclass').length)
这篇关于如何使用jquery检查TR是否包含具有特定CSS类的TD?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文