当前位置: 代码迷 >> Web前端 >> 用jquery步骤操作radio
  详细解决方案

用jquery步骤操作radio

热度:47   发布时间:2013-09-11 16:26:28.0
用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');
        }
    });


  相关解决方案