How to use jQuery's .not and :contains in case of multiple values?
$("table[id=" + tblName + "] tr").not(":contains('" + val + "')").hide();
This code will开发者_运维技巧 hide all TR
s not containing "val".
I have "val1" and "val2" in my code. I wish to hide TR
s not containing both "val1" and "val2"
How do I do that?
^>^ Thanks for your help.
Logically an AND exclusion:
$("table[id=" + tblName + "] tr").not(":contains('" + val1 + "'):contains('" + val2 + "')").hide()
Logically an OR exclusion:
$("table[id=" + tblName + "] tr").not(":contains('" + val + "')").not(":contains('" + val2 + "')").hide();
精彩评论