<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Document</title> </head> <body> <input type="button" value="删除"> <table border=1> <thead> <tr> <th><input type="checkbox"></th> <th>2</th> <th>3</th> <th>4</th> </tr> </thead> <tbody> <tr> <td><input type="checkbox"></td> <td>打两份工</td> <td>真的很高</td> <td><button>删除</button></td> </tr> <tr> <td><input type="checkbox"></td> <td>打两份工</td> <td>真的很高</td> <td><button>删除</button></td> </tr> <tr> <td><input type="checkbox"></td> <td>打两份工</td> <td>真的很高</td> <td><button>删除</button></td> </tr> <tr> <td><input type="checkbox"></td> <td>打两份工</td> <td>真的很高</td> <td><button>删除</button></td> </tr> <tr> <td><input type="checkbox"></td> <td>打两份工</td> <td>真的很高</td> <td><button>删除</button></td> </tr> <tr> <td><input type="checkbox"></td> <td>打两份工</td> <td>真的很高</td> <td><button>删除</button></td> </tr> </tbody> </table> </body> <script src="http://cdn.static.runoob.com/libs/jquery/1.10.2/jquery.min.js"></script> <script> $(function(){ $("input[type=button]").click(function(){ $("tbody").find("input:checkbox:checked").each(function() { // 遍历选中的checkbox n = $(this).parents("tr").index(); // 获取checkbox所在行的顺序 $("tbody").find("tr:eq("+n+")").remove(); }); }); }); $(function(){ $("thead").find("input[type=checkbox]").click(function(){ var flag = $(this).prop("checked"); $("tbody").find("input[type=checkbox]").each(function() { // 遍历选中的checkbox $(this).prop("checked",flag); }); }); }); </script> </html>
js教程
jquery批量全选和反选教程
- jquery教程
-
jQuery获取file控件中图片的宽高与大小
jQuery获取file宽高的代码如下,仅在火狐中测试了,其他浏览器兼容性未知。var _URL = window.URL || window.webkitURL;$("#file").change(function (e) { var file, img; if ((file = this.files[0])) { img = new Image(); img.onload = func...
-
Jquery实战视频教程 6小时精通Jq
Jquery实战视频教程 6小时精通Jq,实现小应用,附带教程源码。视频教程列表第7章 自动以Alert第6章 标记完成状态、定时提醒第5章 Task详情第4章 添加及查看Task第3章 细节完善第2章 整体布局第1章 ...
-
JQuery鼠标移动添加删除样式
JQuery鼠标移动添加删除样式方法,下面为代码案列$("a").hover(function(){ $(this).find("b").show();},function(){ $(this).find("b").hide();})鼠标移到A标签触发事件,下面的B标签显示,后门的function就是鼠标移开隐藏。...
-
js截取字符串教程
slice()方法接受两个参数,起始索引和结束索引(可选)。它返回从起始索引到结束索引(不包括结束索引)之间的子字符...
-
find findIndex indexOf索引选择器使用方法
find使用方法find方法是ES6引入的一种数组方法,可以用来查找数组中符合条件的元素。语法是:array.find(callba...
-
js复制网页内容教程
Async Clipboard API方法HTML5新增的方法,无需引入第三方插件,直接就可以复制内容。低版本的浏览器可能会不兼...
-
js获取字符长度函数分享
js获取字符长度函数function objLen(str) { if (str == null) return 0; if (typeof str != "string") { ...
-
网站LED跑马灯效果广告代码
网站可以看到很多的论坛网站都会用到这种网站LED跑马灯效果,这种效果实现也很简单,分享给大家。LED跑马灯效果...