全选全不选案例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 ...
随机推荐
- 微信小程序图片宽度100%,高度自适应
实现图片自适应,按照一般情况只需设置: img { width: 100%; height: auto; } 但是微信小程序里是特例,需要image标签上设置属性mode=widthFix,就是hei ...
- mysql8.0:SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client
忽然注意到的情况: 2018/7/19至2018/9/13之间发布的7.1.20.7.1.21.7.1.22和7.2.8.7.2.9.7.2.10这六个版本提供的对caching_sha2_passw ...
- linux查看占用内存前10的命令
- Python向excel中写入数据的方法 方法简单
最近做了一项工作需要把处理的数据写入到Excel表格中进行保存,所以在此就简单介绍使用Python如何把数据保存到excel表格中. 数据导入之前需要安装 xlwt依赖包,安装的方法就很简单,直接 p ...
- base64加密后无法解密
记录一个问题: 使用java,或者命令行 base64 命令加密图片文件成加密数据后无法还原成图片 深入:使用java base64工具(sun base64或bouncycastle)加密的数据替换 ...
- 阶段一-01.万丈高楼,地基首要-第3章 用户登录注册模块开发-3-8 优化Swagger2显示
左侧的全是英文 忽略api 把HelloController也忽略掉 重启api的服务,刷新页面.只剩下了passport的Controller 给passport接口加上注解. 重启服务,并刷新页面 ...
- Nginx 配置 HTTP
配置如下 #user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; ...
- 利用nvidia-smi 管理和监控NVIDIA GPU设备
NVIDIA系统管理界面介绍 原文来源:https://developer.nvidia.com/nvidia-system-management-interface NVIDIA系统管理界面(nvi ...
- windows zip命令
针对 Windows 用户的提示: win不自带zip,因此 Windows 用户可以从 GnuWin32 项目页面 上下载zip ,并将 C:\Program Files\GnuWin32\bin( ...
- 转:webpack代码压缩优化
压缩代码 18 天前30前端开发 压缩 JavaScript 修改 JavaScript 压缩处理器 其他压缩 JavaScript 的方法 加快 JavaScript 执行速度 作用域提升 预执行 ...