全选全不选案例table表格
全选全不选案例table表格
案例一纯table表格
<table class="table table-bordered">
<thead class="aa">
<tr>
<th>品类</th>
<th>计量单位</th>
<th>积分</th>
<th>最后修改时间</th>
<th>修改人</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<tr>
<td>废纸</td>
<td>kg</td>
<td>1</td>
<td></td>
<td></td>
<td>
<span class="glyphicon glyphicon-credit-card sp"></span ><span class="sp"> 查看</span>
<span class="glyphicon glyphicon-pencil sp"></span><span class="sp"> 编辑 </span>
<span class="glyphicon glyphicon-trash sp"></span><span class="sp"> 删除 </span>
</td>
</tr>
<tr>
<td>塑料瓶</td>
<td>个</td>
<td>1</td>
<td></td>
<td></td>
<td>
<span class="glyphicon glyphicon-credit-card sp"></span ><span class="sp"> 查看</span>
<span class="glyphicon glyphicon-pencil sp"></span><span class="sp"> 编辑 </span>
<span class="glyphicon glyphicon-trash sp"></span><span class="sp"> 删除 </span>
</td>
</tr>
<tr>
<td>厨余</td>
<td>次</td>
<td>1</td>
<td></td>
<td></td>
<td>
<span class="glyphicon glyphicon-credit-card sp"></span ><span class="sp"> 查看</span>
<span class="glyphicon glyphicon-pencil sp"></span><span class="sp"> 编辑 </span>
<span class="glyphicon glyphicon-trash sp"></span><span class="sp"> 删除 </span>
</td>
</tr>
</tbody> </table>
图一图二如下所示

案例二table表格及全选全不选
<table class="table table-bordered">
<thead class="aa">
<tr>
<th>
<input type="checkbox" id="selectAll" />
</th>
<th>街道</th>
<th>小区</th>
<th>楼号</th>
<th>单元</th>
<th>门牌号</th>
<th>二维码</th>
<th>发卡时间</th>
</tr>
</thead>
<tbody id="tbodyss">
<tr>
<th>
<input type="checkbox" name="check" />
</th>
<td>知春路</td>
<td>世纪花园</td>
<td>1</td>
<td>1</td>
<td>101</td>
<td>150329002842997</td>
<td>2019-7-31 </td>
</tr>
<tr>
<th>
<input type="checkbox" name="check" />
</th>
<td>知春路</td>
<td>世纪花园</td>
<td>1</td>
<td>1</td>
<td>101</td>
<td>150329002842997</td>
<td>2019-7-31 </td>
</tr>
<tr>
<th>
<input type="checkbox" name="check" />
</th>
<td>知春路</td>
<td>世纪花园</td>
<td>1</td>
<td>1</td>
<td>101</td>
<td>150329002842997</td>
<td>2019-7-31 </td>
</tr>
</tbody>
</table>
js代码
$(function(){
var selectAll=$("#selectAll")
selectAll.click(function(){
if (selectAll.prop("checked") == true) {
// 上面的复选框已被选中
$(":checkbox[name='check']").prop("checked", true);
} else {
// 上面的复选框没被选中
$(":checkbox[name='check']").prop("checked", false);
}
})
$("#tbodyss :input").click(function(){
//获取复选框的个数
var length1=$("#tbodyss :input").length
//获取选中的复选框的个数
var length2=$("#tbodyss :checked").length
if(length1 == length2){
$("#selectAll").prop("checked",true);
}else{
$("#selectAll").prop("checked",false);
}
})
})
全选全不选案例table表格的更多相关文章
- 九九乘法表,全js编写,放入table表格带入页面渲染出来
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- Jquery 遍历 Table;遍历CheckBox ;遍历Select;全选/全不选
关于Jquery:相信大家已经很熟悉了,我最近的项目运用到关于Jquery的遍历事件:权当总结下: 遍历Table <table id="thistab"> < ...
- 原生JS实现全选和不全选
案例演示 源代码 <!DOCTYPE html> <html> <head lang="en"> <meta charset=" ...
- Dynamic CRM 2013学习笔记(二十六)报表设计:Reporting Service报表 动态参数、参数多选全选、动态列、动态显示行字体颜色
上次介绍过CRM里开始报表的一些注意事项:Dynamic CRM 2013学习笔记(十五)报表入门.开发工具及注意事项,本文继续介绍报表里的一些动态效果:动态显示参数,参数是从数据库里查询出来的:参数 ...
- jQuery/javascript实现全选全不选
<html> <head> <meta charset="utf-8"> <title>Checkbox的练习</title& ...
- jQuery实现Checkbox中项目开发全选全不选的使用
<html> <head> <meta charset="utf-8"> <title>Checkbox的练习</title& ...
- Jq 遍历 全选 全不选 反选
//全选 全不选 $('#checkAll').click(function () { //判断是否被选中 var bischecked = $('#checkAll').is(':checked') ...
- javascript实现复选框的全选全不选
通过复选框的id获取到复选框 元素 对复选框绑定点击事件 每个checkbox都设置相同的name checkOne 通过得到的元素获取checkbox的状态 当点击全选全不选checkbox时,检查 ...
- VUE实现简单的全选/全不选
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8&quo ...
随机推荐
- Linux环境下安装python3
1.安装前准备 CentOS 7 中默认安装了 Python,版本:2.7.5,由于很多基本的命令.软件包都依赖旧版本,比如:yum.所以,在更新 Python 时,建议不要删除旧版本,而且新旧版本可 ...
- 在 RPA10.X 运行异常,RPA9 却正常的问题处理
一.现象 RPA10.X 在一些极少数 win7/win10 环境中一运行就崩溃或无运行结果. 二.原因 出现上述现象已经确定是OPenGL 驱动兼容性造成的. 三.解决方法 方法一 只要把流程的管理 ...
- Xamarin.FormsShell基础教程(8)Shell的模版构成
Xamarin.FormsShell基础教程(8)Shell的模版构成 Shell模版创建的页面包含内容页.标签栏.侧滑菜单.搜索框四部分.下面依次介绍这几个部分. 内容页:内容页就是为用户呈现内容的 ...
- Android之WebRTC介绍(二)
WebRTC提供了点对点之间的通信,但并不意味着WebRTC不需要服务器.暂且不说基于服务器的一些扩展业务,WebRTC至少有两件事必须要用到服务器: 1. 浏览器之间交换建立通信的元数据(信令)必须 ...
- .netcore里使用StackExchange.Redis TimeOut 情况解决方法
在用StackExchange.Redis这个组件时候,时不时会出现异常TimeOut解决方法如下, 解决方法: 在Program的Main入口方法里添加一句话: System.Threading.T ...
- java多线程(二)线程的生命周期
1. 线程生命周期 新建(New).就绪(Runnable).运行(Running).阻塞(Blocked)和死亡(Dead)5种状态. 1.1. 新建 l new关键字创建了一个线程之后,该线 ...
- python之terminaltables
from terminaltables import AsciiTable, DoubleTable, SingleTable from colorclass import Color, Window ...
- MongoDB开发深入之二:索引
索引分类: 默认索引 单一索引 复合索引 多键索引(数组索引) 全文检索索引 2dsphere 索引 2D索引 ...... 索引属性: 到期TTL 唯一索引 部分索引 稀疏索引 索引通常能够极大的提 ...
- WEB程序设计 第7版
WEB程序设计 第7版 D11章基础知识1.1internet简介1.1.1起源1.1.2internet的含义1.1.3ip地址1.1.4域名1.2万维网1.2.1起源1.2.2web还是int ...
- PAT-2019年冬季考试-甲级 7-2 Block Reversing (25分) (链表转置)
7-2 Block Reversing (25分) Given a singly linked list L. Let us consider every K nodes as a block ( ...