首页 新闻 会员 周边

JQUERY 選擇器問題求助

0
悬赏园豆:50 [已解决问题] 解决于 2010-09-10 12:05

示例代碼:

<input type="checkbox" id="ckb_arrow_1"  />
<input type="checkbox" id="ckb_arrow_2" disabled="true" />
<input type="checkbox" id="ckb_arrow_3" />
<input type="checkbox" id="ckb_arrow_4" />


以下為jquery 代碼,需求是,選中所有checkbox

  $("[id^='ckb_arrow_']").attr("checked",true);  這個能實現將所有checkbox選中

  但是我現在需要,額外剔除 disabled="true" 的不選中,該如何來實現?

alanzengwei的主页 alanzengwei | 初学一级 | 园豆:12
提问于:2010-09-10 11:28
< >
分享
最佳答案
0

$("input[type='checkbox'][disabled!='true']").attr("checked",true);

也可用:

$("input[id^='ckb_arrow_'][disabled!='true']").attr("checked", true);

收获园豆:50
HUHU慈悲 | 大侠五级 |园豆:9973 | 2010-09-10 11:46
其他回答(1)
0

$("input:not(:disabled)")

也可以吧?

rad | 园豆:28 (初学一级) | 2010-09-10 12:29
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册