简体   繁体   中英

Multiple selectors in jQuery

I'm trying to run this code:

$("input[value='OK'][value='Recrutar'][value='Criar'][id!='attack_name_btn']").click();

So, as you see, I'm trying to select a input that has a value equal to "OK" or "Recrutar" or "Criar" and they may not have an id called "attack_name_btn".

But it's not working.

I ckecked this too, multiple selectors jquery

使用多个选择器可以像这样获取与它们中的任何一个匹配的所有对象,然后过滤掉不需要的对象:

$("input[value='OK'], input[value='Recrutar'], input[value='Criar']".filter("[id!='attack_name_btn']").click();

Your code is actually doing an 'and' not an 'or'. What you have is the multiple attribute selector , but what you want is the multiple selector and then filter the results of that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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