jquery radio问题

jack_liu4Ye 2011-08-11 11:32:26


<div id="lightBox_content" style="display:none;">
<div id="operChd" style="text-align:left;padding: 0 0 0 30px;">
<input type="radio" name="chdType" value="asd" >
<span style='width:110;display:inline-block;text-align:left;'>房间隔缺损介入封堵治疗手术</span><br>
<input type="radio" name="chdType" value="ps">
<span style='width:110;display:inline-block;text-align:left;'>肺动脉瓣狭窄球囊成形术手术</span><br>
<input type="radio" name="chdType" value="pda">
<span style='width:110;display:inline-block;text-align:left;'>动脉导管未闭介入封堵治疗手术</span><br>
<input type="radio" name="chdType" value="vsd">
<span style='width:110;display:inline-block;text-align:left;'>室间隔缺损介入封堵治疗手术</span><br>
<input type="radio" name="chdType" value="rasa">
<span style='width:110;display:inline-block;text-align:left;'>主动脉瘤破裂介入封堵治疗手术</span><br>
<input type="radio" name="chdType" value="cafc">
<span style='width:110;display:inline-block;text-align:left;'>冠状动脉瘘介入封堵治疗手术</span><br>
<input type="radio" name="chdType" value="ms">
<span style='width:110;display:inline-block;text-align:left;'>二尖瓣狭窄球囊成形术手术</span><br>
<br>
</div>
<a href="javascript:sendResult()"><img src="<%=request.getContextPath()%>/images/button/b_confirm_3.gif" style="cursor:hand;"/></a> 
</div>
<script>
function coverDiv(uuidRecord,dateRecord){

$.post(cp+"/ajaxs/operation/record/query_chd_oper_name.html",{uuid:uuidRecord},function(data){
if(data!=-1){
$(":radio").eq(data).attr("checked",true);
}
else{
$(":radio").attr("checked",false);
}
var lightBox_content_innerHTML = $("#lightBox_content").html();
addCover(lightBox_content_innerHTML, null, null, null, '300');
uuid = uuidRecord;
date = dateRecord;
})
}
function sendResult(){
var selectRadio = $("input[type='radio']:checked");
alert(selectRadio.length)
var selectRadioVal = selectRadio.val();
alert(selectRadioVal)
if(selectRadioVal==undefined){
alert("请选择先心病手术分类");
}
else{
editInstance(uuid,"/https/operation/record/get_operation_record_create_chd_"+selectRadioVal+"_"+date+".html");
discover();
}
}

</script>


设置某一个radio的checked为true后,

再选其他的radio,会发生多个checked为true,

我只希望得到最后选中的radio的值,

但是按照我上面的写法,还是会得到之前选中的radio值。

PS:调用coverDiv后显示的radio,同时默认设置一个radio的checked为true。。
...全文
148 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

81,095

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧