Is it possible that the user could select any column of a table and that I could make it possible with jQuery?
I have the example here to play: http://jsbin.com/oluyex/1/edit
jQUERY. I don’t know how to select the children of each th:
$(function(){
$("th").click(function(){
$(this).("children").css("background-color","red");
});
})
HTML:
<table id="taula" border="1">
<tr>
<th>Header 1</th>
<th>Header 2</th>
</tr>
<tr>
<td>row 1, cell 1</td>
<td>row 1, cell 2</td>
</tr>
<tr>
<td>row 2, cell 1</td>
<td>row 2, cell 2</td>
</tr>
</table>
To do this all you need to do is get the index of the table header and then use that index to apply the class to each table cell in the column. You’ll have to loop through each row to find the appropriate table cell. – http://jsfiddle.net/BMGKv/