Getting td by index with jQuery

How about using the nth-child selector?

http://api.jquery.com/nth-child-selector/

var row = 4;
var col = 2

var cell = $('table#tableId tr:nth-child(' + row + ') td:nth-child(' + col + ')');

Note that the child index is 1-based, rather than the more usual 0-based.


With plain JavaScript:

// table is a reference to your table
table.rows[rowIndex].cells[columnIndex]

Reference: HTMLTableElement, HTMLTableRowElement


With jQuery, you could use .eq():

$('#table tr').eq(rowIndex).find('td').eq(columnIndex)
// or
$('#table tr:eq(' + rowIndex + ') td:eq(' + columnIndex + ')')