[转]jQuery: get table column/row index remove table column (by column number)
本文转自:http://www.xinotes.org/notes/note/1087/
<!DOCTYPE html>
<html>
<head>
<title>jQuery Table</title>
<style type="text/css">
body {
font-family: sans-serif;
}
table {
border-collapse: collapse;
margin-bottom: 5px;
}
td {
padding: 4px;
border: #4488aa 1px solid;
}
input {
text-align: right;
padding: 2px;
width: 20px;
}
</style>
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js">
</script>
<script type="text/javascript">
$(function() {
$('td').click(function() {
var tr = $(this).parent();
for (var i = 0; i < tr.children().length; i++) {
if (tr.children().get(i) == this) {
var column = i;
break;
}
}
var tbody = tr.parent();
for (var j = 0; j < tbody.children().length; j++) {
if (tbody.children().get(j) == tr.get(0)) {
var row = j;
break;
}
}
$('span').text(row + ', ' + column);
});
});
</script>
</head>
<body>
<h1>Table Cell Value</h1>
<table>
<tr><td>Cell 1-1</td><td>Cell 1-2</td><td>Cell 1-3</td></tr>
<tr><td>Cell 2-1</td><td>Cell 2-2</td><td>Cell 2-3</td></tr>
<tr><td>Cell 3-1</td><td>Cell 3-2</td><td>Cell 3-3</td></tr>
</table>
You clicked cell: <span>None</span>
</body>
</html>
本文转自:http://www.jquery4u.com/snippets/jquery-remove-table-column-by-column-number/
Simple jQuery code snippet to remove an entire table column based on the column number. It also removes the table row heading associated with the removed column.
//remove the 1st column
//remove the 2nd column
//remove the nth column
[转]jQuery: get table column/row index remove table column (by column number)的更多相关文章
- jQuery EasyUI, datagrid, treegrid formatter 参数比较 row index
如题: datagrid中,见官方文档: formatter function The cell formatter function, take three parameter:value: the ...
- [20180317]12c TABLE ACCESS BY INDEX ROWID BATCHED3.txt
[20180317]12c TABLE ACCESS BY INDEX ROWID BATCHED3.txt --//简单探究12c TABLE ACCESS BY INDEX ROWID BATCH ...
- [20180317]12c TABLE ACCESS BY INDEX ROWID BATCHED.txt
[20180317]12c TABLE ACCESS BY INDEX ROWID BATCHED.txt --//简单探究12c TABLE ACCESS BY INDEX ROWID BATCHE ...
- mysql 添加索引,ALTER TABLE和CREATE INDEX的区别
nvicat-->mysql表设计-->创建索引. (1)使用ALTER TABLE语句创建索引,其中包括普通索引.UNIQUE索引和PRIMARY KEY索引3种创建索引的格式: PRI ...
- Replication-Replication Distribution Subsystem: agent xxxxxx failed. Column names in each table must be unique
最近遇到一个关于发布订阅(Replication)的奇葩问题,特此记录一下这个案例.我们一SQL SERVER数据库服务器出现大量告警.告警信息如下所示: DESCRIPTION: Replicati ...
- Mysql运行SQL文件 错误Incorrect table definition;there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause
问题描述 想从服务器上DOWN下数据库.操作:先把数据库转存为SQL文件,然后在本地利用navicate运行SQL文件,出现错误信息: Incorrect table definition;there ...
- Error Code: 1175.You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column.
在MySQL Workbench里面使用SQL语句: delete from 表名 提示出错: Error Code: 1175.You are using safe update mode and ...
- [转载]jquery获取元素索引值index()方法:
jquery的index()方法 搜索匹配的元素,并返回相应元素的索引值,从0开始计数. 如果不给 .index() 方法传递参数,那么返回值就是这个jQuery对象集合中第一个元素相对于其同辈元素的 ...
- jquery获取元素索引值index()方法
jquery的index()方法 搜索匹配的元素,并返回相应元素的索引值,从0开始计数. 如果不给 .index() 方法传递参数,那么返回值就是这个jQuery对象集合中第一个元素相对于其同辈元素的 ...
随机推荐
- tcpdump/HTTP协议实践
tcpdump/HTTP协议实践 客户端: CLOSED->SYN_SENT->ESTABLISHED->FIN_WAIT_1->FIN_WAIT_2->TIME_WAI ...
- 《Head First Servlets & JSP》-4-请求和响应
Servlet生命周期 生命周期三大重要时刻 Servlet集成结构: 方法 init() service() doGet()/goPost() 何时调用 Servlet实例被创建之后.为客户请求提供 ...
- java多线程系列:CountDownLatch
这篇文章将介绍CountDownLatch这个同步工具类的基本信息以及通过案例来介绍如何使用这个工具. CountDownLatch是java.util.concurrent包下面的一个工具类,可以用 ...
- iframe加载的文档高度
var clientHeight = $("#iframe").contents().find("body").height();
- PDG转图像、PDF的若干方法
作者:马健邮箱:stronghorse_mj@hotmail.com发布:2006.05.26更新:2008.08.24 补充说明:此文成文较早,其中对Pdg2Pic.FreePic2Pdf的描述早已 ...
- Spring Boot 学习系列(02)—使用热部署,提升开发效
此文已由作者易国强授权网易云社区发布. 欢迎访问网易云社区,了解更多网易技术产品运营经验. 开发调试很简单 热部署的使用非常简单,但能极大的提高我们的开发效率,像传统的web应用,我们修改后需要重新编 ...
- C++期中考试
第一题1. 补足日期类实现,使得能够根据日期获取这是一年中第多少天.(12分) date.h #ifndef DATE_H #define DATE_H class Date { public: Da ...
- Java框架之单元测试
单元测试dao层 @Test //1.要写 test public void TestUserDao(){ ApplicationContext ctx=new ClassPathXmlAppli ...
- Node JS爬虫:爬取瀑布流网页高清图
原文链接:Node JS爬虫:爬取瀑布流网页高清图 静态为主的网页往往用get方法就能获取页面所有内容.动态网页即异步请求数据的网页则需要用浏览器加载完成后再进行抓取.本文介绍了如何连续爬取瀑布流网页 ...
- web flash推流录制测试研究
用flash as3写了一段推流测试demo,参考srs_publisher和simplest_as3_rtmp_streamer.推流到srs2服务器,录制为flv文件.测试一轮结果如下: Web ...