为每个Jquery单元格点击获得相应单元格值

$(document).ready(function () {

//点击#table3 的单元格返回 单元格索引

$(“#table3 td”).click(function () {

var tdSeq = $(this).parent().find(“td”).index($(this));

var trSeq = $(this).parent().parent().find(“tr”).index($(this).parent());

alert(“第” + (trSeq) + “行,第” + (tdSeq+1) + “列”);

})

});

如果要获得指定单元格的值

var tdSeq = $(this).parent().find(“td”).eq(n).html();

 

Leave a Reply

您的电子邮箱地址不会被公开。 必填项已用 * 标注

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>