[转]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对象集合中第一个元素相对于其同辈元素的 ...
随机推荐
- android加载字体内存泄漏的处理方法
在开发android app的开发过程中,会使用到外部的一些字体.外部字体在加载的时候,容易造成内存泄漏. 比如: Typeface tf=Typeface.createFromAsset(getAs ...
- [转]CentOS 7.3 安装MySQL
1.下载mysql源 yum -y install wget wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarc ...
- c# 匿名函数和lamda表达式语法
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...
- iOS symbolicatecrash工具crash日志分析
若一个App没有加入Crashlytics或者Buggly这些崩溃日志监控,那么我们在App崩溃的时候如何获取崩溃信息呢? 此时我们可以通过symbolicatecrash工具对手机日志来进行分析定位 ...
- Redhat 6 git服务器配置 (git-daemon)
git-daemon是按照git的自己的git协议进行访问git服务 1.git-daemon软件安装 软件仓库见 redhat 6 git 服务器 配置 (http) 2.配置git dae ...
- How can I list colors in WPF with XAML?
How can I get list of all colors I can pick in Visual Studio Designer (which is System.Windows.Media ...
- KDevelop4调试pcl一直读取不到.pcd文件
如题所示,KD下,能编译,运行时一直使用reader.read读取不到pcd,但是使用cmake能正常运行. 后来,使用terminator删掉工程的build文件夹,直接在工程文件下进行编译,报错提 ...
- ASP.NET-GridView分页排序显示
前期我们分别介绍了gridview怎么进行固定表多行数据显示,以及怎么设计花样表头.下面我们介绍怎么利用gridview进行分页显示的同时还可以进行排序显示. 显示效果 前端DEMO <span ...
- IE下 checkbox、radio等标签的label中的img点击无效(点击不能选中)问题解决
类似以下代码,点击图片不能选中checkbox <input id="dw_1" name="shape[]" value="Round&quo ...
- webpack4.0入门配置文件
wepback风头正火 ,但是公司一直在用gulp,正好赶上年底活动,借此机会第一次尝试了webpack,说实话webpack真的很强大,内容一层一层递进. 这几天跟着官网跑了一遍,然后写了自己的配置 ...