Getting td by index with jQuery

后端 未结 3 1077
感动是毒
感动是毒 2020-12-13 09:00

I know how to get a cell\'s row and column index with jQuery, but I can\'t figure out the reverse. Given a row and column index, how would I access the td at this location?<

3条回答
  •  隐瞒了意图╮
    2020-12-13 09:48

    You can use the :eq selector:

    var row = 1;
    var col = 2;
    var cell = $('table tr:eq(' + row + ') td:eq(' + col + ')');
    

    Here's an example of this in action

提交回复
热议问题