返回表格行 或 列的索引
td是列,tr是行:
<script type="text/javascript">
$(document).ready(function(){
$("table td").bind("click",function(){
var index = $(this).parent().index();
alert(index);//表示所在行的索引。如果要的是列的索引,把parent()去掉
});
});
</script>
返回 closest指定元素 最近的 table 元素
var tableId = $(‘input[class="daobubili"]‘).closest("table").attr("id");
获得表格索引 index();
jquery找到指定表格的td列
$("#tab tr").find("td:eq(7)");
特殊的表格模板 记得设置thead这样遍历 tbody tr就不会有标题行了。
<table>
<thead>
<tr>
<th style="display:none">隐藏</th>
<th width="5%">序号</th>
</tr>
</thead>
<tbody>
<tr moban style="height: 33px;display: none" >
</tr>
<tbody>
</table>
原文:http://www.cnblogs.com/hui-blog/p/5075802.html