I have an HTML table with a link in the first column. I want to allow the user to click anywhere in the row to activate that link. At the same time, I would like to preserve the middle click and ctrl+click functionality of opening a new tab/window. Here is an example of the table:
<table id="row_link">
<tbody>
<tr>
<td><a href="link1.html">link</a></td>
<td>info 1</td>
</tr>
<tr>
<td><a href="link2.html">link</a></td>
<td>info 2</td>
</tr>
</tbody>
</table>
Using jQuery I can allow the user to left click anywhere in a row:
$("table#row_link tbody tr").click(function () {
window.location = $(this).find("a:first").attr("href");
});
This of course disables the standard middle click and ctrl+click functionality of opening a new tab. Is there a better way to allow users to click on the entire row while preserving the standard middle click and ctrl+clcik behavior?