I have a large table, and I need to be able to select a specific cell using it's cell/row coordinates.
What's the most elegant way of doing this using jQuery?
Please enter this formula: =INDIRECT(ADDRESS(F1,F2)), and press Enter key to get the result, see screenshot: Note: In the above formula, F1 and F2 indicate the row number and column number, you can change them to your need.
You can also click anywhere in the table column, and then press CTRL+SPACEBAR, or you can click the first cell in the table column, and then press CTRL+SHIFT+DOWN ARROW.
Or click on any cell in the column and then press Ctrl + Space. Select the row number to select the entire row. Or click on any cell in the row and then press Shift + Space. To select non-adjacent rows or columns, hold Ctrl and select the row or column numbers.
Press F5 or CTRL+G to launch the Go To dialog. In the Go to list, click the name of the cell or range that you want to select, or type the cell reference in the Reference box, then press OK. For example, in the Reference box, type B3 to select that cell, or type B1:B3 to select a range of cells.
This is one case where I think using native JavaScript actually makes the code easier to understand:
var table = $("#table")[0];
var cell = table.rows[1].cells[1]; // This is a DOM "TD" element
var $cell = $(cell); // Now it's a jQuery object.
Note that just selecting the table
element will make rows
include those rows in your thead
(and tfoot
). What you probably want is:
var table = $("#table tbody")[0];
/* remaining code from above */
Here's an example: http://jsfiddle.net/CgqQt/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With