点击<tr>表格行元素进行跳转

意外发现table中利用<a>标签控制tr的行为无效。

尝试<a>标签在table中的使用,只有在<td><a href=""></a><td>的情况下有效。

那么如何实现<tr>标签的点击跳转?使用jquery实现:

 1 <table>
 2 <tbody>
 3     <tr class="jump">
 4         <input type="hidden" href="jump.php"/>
 5         <td>1</td>
 6         <td>2</td>
 7     </tr>
 8 </tbody>
 9 </table>
10 
11 /*jquery部分*/
12 <script>
13         $(".jump").click(function () {
14             location.href = $(this).children("input").attr("value");
15         });
16 </script>
原文地址:https://www.cnblogs.com/hhccdf/p/6485916.html