本文转自: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
$('#table').find('td,th').first().remove();
//remove the 1st column
$('table tr').find('td:eq(1),th:eq(1)').remove();
//remove the 2nd column
$('table tr').find('td:eq(1),th:eq(1)').remove();
//remove the nth column
$('table tr').find('td:eq(n),th:eq(n)').remove();

[转]jQuery: get table column/row index remove table column (by column number)的更多相关文章

  1. jQuery EasyUI, datagrid, treegrid formatter 参数比较 row index

    如题: datagrid中,见官方文档: formatter function The cell formatter function, take three parameter:value: the ...

  2. [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 ...

  3. [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 ...

  4. mysql 添加索引,ALTER TABLE和CREATE INDEX的区别

    nvicat-->mysql表设计-->创建索引. (1)使用ALTER TABLE语句创建索引,其中包括普通索引.UNIQUE索引和PRIMARY KEY索引3种创建索引的格式: PRI ...

  5. Replication-Replication Distribution Subsystem: agent xxxxxx failed. Column names in each table must be unique

    最近遇到一个关于发布订阅(Replication)的奇葩问题,特此记录一下这个案例.我们一SQL SERVER数据库服务器出现大量告警.告警信息如下所示: DESCRIPTION: Replicati ...

  6. 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 ...

  7. 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 ...

  8. [转载]jquery获取元素索引值index()方法:

    jquery的index()方法 搜索匹配的元素,并返回相应元素的索引值,从0开始计数. 如果不给 .index() 方法传递参数,那么返回值就是这个jQuery对象集合中第一个元素相对于其同辈元素的 ...

  9. jquery获取元素索引值index()方法

    jquery的index()方法 搜索匹配的元素,并返回相应元素的索引值,从0开始计数. 如果不给 .index() 方法传递参数,那么返回值就是这个jQuery对象集合中第一个元素相对于其同辈元素的 ...

随机推荐

  1. 存储过程自动更新ID

    DECLARE @i int --更新题序编号 UPDATE UserAnswer SET @i=@i+,TestOrder=@i WHERE UserScoreID=' //根据ID 累加更新

  2. DropDownList判断值是否存在下拉列表中

    //1.值是text string aa= Request.QueryString["CallReason"].ToString();//获取传值 if (DropDownList ...

  3. jquery文件上传控件 Uploadify 可以和ajax交互

    http://www.cnblogs.com/mofish/archive/2012/11/30/2796698.html  原网址 基于jquery的文件上传控件,支持ajax无刷新上传,多个文件同 ...

  4. javascript javascript加载类似星座、血型的函数

     javascript加载类似星座.血型的函数 //加载血型 function bloodtypelaod(constellation) { var obj = document.getElement ...

  5. 教学ppt设计与制作

    分三部分陈述,分别是元素呈现/版面设计/导航设计/. 1 元素呈现 文本 (1)字符表现策略 少用宋体 多用黑体,微软雅黑等 少用艺术字 (2)段落表现策略 条目化 一行一条 用符号简化文字描述 按有 ...

  6. JAVA学习第三篇Boolean

    Boolean是布尔值. 布尔值只有两个值:真和假.写作:true false. 那么如何使用呢? 最简单的用法: public class demo{ public static void main ...

  7. 基于vue框架项目开发过程中遇到的问题总结(三)

    这次遇到的一个问题困扰了我很久很久,大致就是vue路由的addRoutes方法的使用,每次在调用了这个之后router对象中并没有将路由添加进去,接下来,我一步一步的分析原因及解决方法(个人见解,仅供 ...

  8. 基于vue实现上下滑动翻页效果

    18年年底的时候,一直在做年度报告的H5页面,因为项目需要,需要实现上下滑动翻页,并且上滑的页面比正常页面的比例要缩小一定比例. 效果类似于http://www.17sucai.com/pins/de ...

  9. css边跨实例

    <!doctype html><html lang="zh-cn"> <head> <meta http-equiv="Cont ...

  10. Jmeter-响应结果unicode转成中文显示

    本文为转载微信公众号文章,如作者发现后不愿意,请联系我进行删除 原文链接:http://mp.weixin.qq.com/s?__biz=MjM5OTI2MTQ3OA==&mid=265217 ...