Welcome 微信登录

首页 / 脚本样式 / JavaScript / 用jquery方法操作radio使其默认选项是否

复制代码 代码如下:
<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");
}
});