arrowill12
arrowill12

Reputation: 1804

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(). 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. is this possible?

thanks

Upvotes: 2

Views: 1314

Answers (2)

adeneo
adeneo

Reputation: 318192

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

Upvotes: 1

Alnitak
Alnitak

Reputation: 339816

Sure, as you want an and condition, that's just the same as filtering for both matches independently.

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

Upvotes: 1

Related Questions