I have a table and I want every row to be clickable. Right now, I’m doing the simple:
$('tr').click(...)
This works for the most part but how can I make it act like a link in these ways:
- Shift-click opens the target in a new window
- Middle clicking opens the target in a new tab
- Hovering shows the link address in the status bar
That’s technically feasible in some browsers, but not all, and for those that do support it, it’s a lot of work. You have to intercept the keyboard and non-left click events. You’d probably be better off just wrapping the contents of each TD in a regular A tag.
Going the JS/override route also doesn’t degrade gracefully… if all you’re doing is truly just linking to another page like a typical HREF, it’s almost silly to make that dependent on JavaScript.