使表格行可单击,同时保留附加链接的功能
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了使表格行可单击,同时保留附加链接的功能相关的知识,希望对你有一定的参考价值。
First: clicking on a table row forwards you to the URL given in the first As href attribute. ------ Second: clicking on a link inside the row triggers the default action **AND** a click event on the table row. This needs to be stopped, so the default action is replaced by our own and propagation to higher elements is stopped. ----- Nice to have: Hand cursor when hovering over a table row. CSS!
$('tr.msg').click(function() { document.location = $(this).find('a.msg-link').attr('href'); }); $('tr.msg a').click(function(e) { e.stopPropagation(); e.preventDefault(); document.location = $(this).attr('href'); });
以上是关于使表格行可单击,同时保留附加链接的功能的主要内容,如果未能解决你的问题,请参考以下文章
React/AntDesign 如何使行可拖动? (表格拖动排序)