返回表格行 或 列的索引

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>	

  

标签: none


阿里云优惠主机

添加新评论

免责声明
本博客部分内容来自于互联网,不代表作者的观点和立场,如若侵犯到您的权益,请联系[email protected]。我们会在24小时内进行删除。