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

复选框作为按钮 实现全选/不全选

时间:2014-06-30 21:37:56      阅读:298      评论:0      收藏:0      [点我收藏+]

标签:cti   时间   io   type   table   app   

  $(function () {
            $("#checkAll").click(function () {
                $(‘input[name="infoids[]"]‘).attr("checked", this.checked);
            });
            var $subBox = $("input[name=‘infoids[]‘]");
            $subBox.click(function () {
                $("#checkAll").attr("checked", $subBox.length === $("input[name=‘infoids[]‘]:checked").length ? true : false);
            });
        });

 

 

 <table class="datalist">
                    <tr>
                        <td class="rv_td3">用户昵称</td>
                        <td class="rv_td4">评价内容</td>
                        <td class="rv_td5">评价时间</td>
                        <td class="rv_td7">是否显示
                            <input type="checkbox" id="checkAll" name="checkAll" value="1"/>
                        </td>
                    </tr>
                    <volist name="list" id="vo">
                        <tr>
                            <td class="rv_td3">{$vo.nick_name}</td>
                            <td class="rv_td4">{$vo.review_content}</td>
                            <td class="rv_td5">{$vo.review_time}</td>
                            <td class="rv_td7">
                                <if condition="($vo.appear eq 1)">
                                    <input type="checkbox" id="infoids" name="infoids[]" value="{$vo.id}" checked/>
                                    <else/>
                                    <input type="checkbox" id="infoids" name="infoids[]" value="{$vo.id}"/>
                                </if>
                            </td>
                        </tr>
                    </volist>
                </table>

复选框作为按钮 实现全选/不全选,布布扣,bubuko.com

复选框作为按钮 实现全选/不全选

标签:cti   时间   io   type   table   app   

原文地址:http://www.cnblogs.com/xiaofendui/p/3816114.html

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