首页 > 其他 > 详细

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

时间:2017-03-01 20:37:31      阅读:1725      评论:0      收藏:0      [点我收藏+]

意外发现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>

 

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

原文:http://www.cnblogs.com/hhccdf/p/6485916.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!