当前位置:编程学习 > JAVA >>

用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');
        }
    });

 

补充:web前端 , JavaScript ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,