Using Click Events to Hyperlink Table Rows

时间:2016-10-20 19:27:17

标签: javascript jquery html

I am new to HTML/CSS/JS/etc, and have the following objective: I am trying to effectively hyperlink individual rows in tables. I am aware that this is not inherently possible, but have found that the solution I prefer most is simply using onclick methods. However...

Is there a way to distinguish mouse buttons for different reactions? Effectively, I am trying to mimic the usual reaction of mouse clicks for a link e.g., left click opens the link in the current tab, middle click opens the link in a new tab, and right click opens up the context menu for links.

What I know:

  • I can open the link in the current tab with a simple link, or in a new tab/window by using window.open
  • I can have it react to only the left click with onclick, or to all three with onmousedown or onmouseup

Thanks for the help!

1 个答案:

答案 0 :(得分:0)

I was able to accomplish my goal with the following solution:

How to make entire table cell clickable when it has a hyperlink - using bootstrap v3

All I did after it was then stylize the hyperlink text as desired.