码迷,mamicode.com
首页 > 其他好文 > 详细

多组 RadioButtonList 获取值

时间:2016-10-12 11:19:49      阅读:101      评论:0      收藏:0      [点我收藏+]

标签:


<div class="row">
    <table>
        <thead><tr><th>操作</th></tr></thead>
        <tbody>
            <tr>
                <td>
                    <input type="radio" name="3" value="Update" />覆盖
                    <input type="radio" name="3" value="Insert" />更新
                    <input type="radio" name="3" value="Cancel" />取消
                </td>
            </tr>
            <tr>
                <td>
                    <input type="radio" name="2" value="Update" />覆盖
                    <input type="radio" name="2" value="Insert" />更新
                    <input type="radio" name="2" value="Cancel" />取消
                </td>
            </tr>
            <tr>
                <td>
                    <input type="radio" name="5" value="Update" />覆盖
                    <input type="radio" name="5" value="Insert" />更新
                    <input type="radio" name="5" value="Cancel" />取消
                </td>
            </tr>
        </tbody>
    </table>
    <input type="button" id="btnTry" value="更新" />
</div>
<script type="text/javascript" src="~/Scripts/jquery-1.10.2.min.js"></script>
<script type="text/javascript">
    jQuery("#btnTry").click(function () {
        var updateIds = ‘‘;
        $(‘input:radio[value="Update"]:checked‘).each(function (i, val) {
            updateIds += val.name+‘;‘;
        });
        var insertIds = ‘‘;
        $(‘input:radio[value="Insert"]:checked‘).each(function (i, val) {
            insertIds += val.name + ‘;‘;
        });
        alert(‘Update:‘+updateIds);
        alert(‘Insert:‘+insertIds);
    });

</script>

多组 RadioButtonList 获取值

标签:

原文地址:http://www.cnblogs.com/jimcsharp/p/5951549.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!