简体   繁体   English

有没有办法在 jquery:contains() 选择器中使用多个字符串?

[英]is there a way to use multiple strings in the jquery :contains() selector?

hi i was wondering if there is a way to use multiple strings in the jquery selector :contains() .嗨,我想知道是否有办法在jquery选择器中使用多个字符串:contains() for example I would liek to do something like this:例如,我会做这样的事情:

 $("#"+idArray[i]).find("th:Contains(" + query && query2 + ")").closest($(".instTable, .break")).show();

similar to an if statement's sysntax.类似于 if 语句的语法。 is this possible?这可能吗?

thanks谢谢

Sure, as you want an and condition, that's just the same as filtering for both matches independently.当然,正如您想要一个and条件一样,这与独立过滤两个匹配项相同。

$(selector).find('th:contains(' + query1 +'):contains(' + query2 + ')') ...
$('th:contains('+ query +'), th:contains('+ query2 +')')....

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM