简体   繁体   中英

check next not disabled radio button

I have a bunch of radio buttons, and depending on the choices of other radio buttons, some of radio's are disabled. The problem is that they the disabled ones remain checked. It's hard to explain this and it's not something I can show in code, because it's just a bunch of garbage and experiments.

So anyway, my question is, how do you find the first not disabled radio button in a radio button group (same name)?

Thanks for your help.

$(':radio:not(:disabled):first')

没有先,它会找到所有未禁用的无线电。

You can find all radiobuttons with :radio

You can reduce that result with :not

You can target all disabled elements with :disabled

You can return the first element from the given set with :first

$('input:radio:not(:disabled):first')

If you want to find out which radiobutton is checked, disregarding any disabled ones, you may want to do something like

$('input:radio:checked:not(:disabled)')

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