美文网首页
jQuery获取table当前所在行和列

jQuery获取table当前所在行和列

作者: 一个记事本 | 来源:发表于2018-07-20 11:06 被阅读7次

$(".event-TDclick").click(function() {

    $(this).toggleClass("onClasss");
            
    var tdSeq = $(this).parent().find("td").index($(this)[0]);
    var trSeq = $(this).parent().parent().find("tr").index($(this).parent()[0]);
    alert("第" + (trSeq) + "行,第" + (tdSeq) + "列");

});

相关文章

网友评论

      本文标题:jQuery获取table当前所在行和列

      本文链接:https://www.haomeiwen.com/subject/ciufmftx.html