码迷,mamicode.com
首页 > 其他好文 > 详细

如何得到table得到鼠标所点的 行号和 列号

时间:2016-12-28 14:57:48      阅读:377      评论:0      收藏:0      [点我收藏+]

标签:htm   ready   行号   his   data   query   html   on()   jquery   

$(document).ready(function(){
  $(".mytable td").click(function(){
    var tdSeq = $(this).parent().find("td").index($(this)[0]);
    var trSeq = $(this).parent().parent().find("tr").index($(this).parent()[0]);
    alert("第" + (trSeq + 1) + "行,第" + (tdSeq + 1) + "列");
  });
})

 

 

 

jquery 取得 table 几行几列的内容:

取值$("#dataTable tr:eq("+rowindex+") td:eq("+colindex")").html()

 

给值$("#dataTable tr:eq("+rowindex+") td:eq("+colindex")").html("abc")

 

如何得到table得到鼠标所点的 行号和 列号

标签:htm   ready   行号   his   data   query   html   on()   jquery   

原文地址:http://www.cnblogs.com/x6x6x6/p/6229357.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!