javascript - Make table cells with <a> clickable and respect tabbed browsing -
right i'm doing td.click()
, window.location = td.find('a').attr('href')
doesn't work if i'm clicking make new tab.
and can't programmatically click <a>
.
any ideas?
feel free fork fiddle http://jsfiddle.net/udqpr/
you make <a>
fill entire cell. way, won't need additional javascript handle click event. adding target="_blank"
<a>
link make open in new tab (or new window, browsers don't support tabs). working example @ http://jsfiddle.net/vtyac/2/.
here's table code:
<table> <tr> <td> <a href="http://apple.com" target="_blank">apple</a> </td> <td> <a href="http://youtube.com" target="_blank">youtube</a> </td> </tr> </table>
and css:
td { border: 1px solid; } { text-decoration: none; display: block; width: 100%; height: 100%; padding: 10px } a:hover { text-decoration: underline; }
Comments
Post a Comment