最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - check next not disabled radio button - Stack Overflow

programmeradmin7浏览0评论

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.

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.

Share Improve this question asked Nov 24, 2010 at 13:43 donkdonk 1,5704 gold badges23 silver badges46 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 6
$(':radio:not(:disabled):first')

without first it will find all not disabled radios.

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)')
发布评论

评论列表(0)

  1. 暂无评论