×

用jQuery的radio操作

作者:jiang2018.05.01来源:Web前端之家浏览:11557评论:0
关键词:JQueryJS
<tr> 
<th>是否映射:</th> 
<td> 
<input type="radio" name="sfys" class="radio" id="yes" 
value="1"/><label for="yes">是</label> 
<input type="radio" name="sfys" class="radio" id="no" 
value="0"/><label for="no">否</label> 
</td> 
</tr>

用jquery方法操作,使其默认选项是否.

$(function () {
var sfys = "<#if os??&&os.sfys??>${os.sfys}</#if>"; 
if (sfys == '1') { 
$("#yes").attr('checked', 'checked'); 
} else { 
$("#no").attr('checked', 'checked'); 
} 
});

您的支持是我们创作的动力!
温馨提示:本文作者系 ,经Web前端之家编辑修改或补充,转载请注明出处和本文链接:
https://jiangweishan.com/article/svg1488038400578.html

网友评论文明上网理性发言 已有0人参与

发表评论: