Using jQuery you could attach a click
event listener to the entire <td>
element.
Assuming that the variable redirectLink
was defined earlier in the script.
for example :
var redirectLink = "http://msmvps.com/blogs/jon_skeet/";
but this could be any other awesome URL u choose ;)
$(".cellLink").click(function(){
// execute the redirect here
top.location.href = redirectLink;
});
The $(".cellLinks")
is a jQuery Selector that includes all elements with the cellLink
class on them. example:
<td class="cellLink">c 1</td>
cellLink
is just a name that I invented - you can call it whatever name sounds logical to you.
The same could be achieved on an entire row if you place the same cellLink
class on it :
<tr class="cellLink">
<td>...</td>
...
</tr>
In this case it might be a better idea to call it something more generic.