更新时间:2022-11-01 13:19:25
要获取不匹配",您可以使用具有属性选择器,如下所示:
To get a "doesn't match", you'd use an attribute not-equals selector with (the other part of the question) as has-attribute selector, like this:
$("span[a][a!='4']")
如果您希望它等于,只需取出!
以获得属性等于选择器,如下所示:
If you want it to equal, just take out the !
for an attribute-equals selector, like this:
$("span[a][a='5']")
要使用变量,只需将其连接起来,就像这样:
To use a variable, just concatenate, like this:
$("span[" + my_attr + "][" + my_attr + "!='" + my_value + "']")