当前位置: 首页 > 新闻动态 > 软件编程

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

作者:用户投稿 浏览: 发布日期:2026-01-16
[导读]:用jquery方法操作,使其默认选项是或否,具体实现如下,喜欢的朋友不妨参考下,或许可以用得到哦
复制代码 代码如下:
<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');
}
});
免责声明:转载请注明出处:http://shjed.com/news/203545.html

扫一扫高效沟通

多一份参考总有益处

免费领取网站策划SEO优化策划方案

请填写下方表单,我们会尽快与您联系
感谢您的咨询,我们会尽快给您回复!