I have seen a few similar questions but nothing that answers this specific problem. Consider the following table:
<table id="foo" border="1px">
<tr>
<td rowspan="2">one</td>
<td>two</td>
<td rowspan="2">three</td>
<td>four</td>
<td>five</td>
</tr>
<tr>
<td rowspan="2">two</td>
<td>four</td>
<td>five</td>
</tr>
<tr>
<td rowspan="2">one</td>
<td>three</td>
<td>four</td>
<td>five</td>
</tr>
<tr>
<td>two</td>
<td>three</td>
<td>four</td>
<td>five</td>
</tr>
</table>
Using jQuery, how can I select all items in a specific visual column? For example, if I want to select column 3, I should get all td's with 'three' as content.
Give each of your row / columns classes. So row 1 column 1 would have
class='Row1 Column1'
Then select on the class as needed. (If you do not want to ever select on rows you would not need the row specification just trying to extrapolate out how to do the grid.Haven't looked at the posted plugin, but I found the question interesting so I created a fiddle!
http://jsfiddle.net/PBPSp/
If the pluggin works it may be better than this, but it was a fun exercise so I may as well post it.
Change
colToGet
to whichever column you want to highlight.This plugin handles complex colspan and rowspan selection:
I am not sure how you want to select them, but something like this?
What do you want to do with the TDs after you select them?
This is the description of https://github.com/gajus/wholly, a plugin that I have developed for this purpose. Using the events you can find all the values in the row or in a col, including those attached using rowspan or solspan properties.
I made a visualisation illustrating a table and the events that are triggered upon navigation.
Orange is the active cell, red are the cells triggered by the vertical event and blue are the cells triggered by the horizontal event.