Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/459.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 引导式手风琴台内带链接的按钮_Javascript_Jquery_Html_Twitter Bootstrap - Fatal编程技术网

Javascript 引导式手风琴台内带链接的按钮

Javascript 引导式手风琴台内带链接的按钮,javascript,jquery,html,twitter-bootstrap,Javascript,Jquery,Html,Twitter Bootstrap,我有一个自助式手风琴台,效果非常好。基本上,如果有人单击一行,它会显示更多的内容。现在,问题是其中一行包含一个按钮链接,当有人单击该按钮时,它会正确地转到该链接,但它也会打开隐藏的行内容 我该怎么做才能使当有人点击按钮时,它也不会打开隐藏的行而只转到链接 <table class="table"> <thead> <th width="20%" class="">Row 1</th> <th width="20%" class="">

我有一个自助式手风琴台,效果非常好。基本上,如果有人单击一行,它会显示更多的内容。现在,问题是其中一行包含一个按钮链接,当有人单击该按钮时,它会正确地转到该链接,但它也会打开隐藏的行内容

我该怎么做才能使当有人点击按钮时,它也不会打开隐藏的行而只转到链接

<table class="table">

<thead>

<th width="20%" class="">Row 1</th>
<th width="20%" class="">Row 2</th>
<th width="20%" class="">Row 3</th>
<th width="20%" class="">Row 4</th>
<th width="20%" class="">Row 5</th>

</thead>

<tbody>

<tr data-toggle="collapse" data-target="#123" class="accordion-toggle">

<td class="">Content 1</td>
<td class="">Content 2</td>
<td class="">Content 3</td>
<td class="">Content 4</td>
<td class=""><a href="http://www.url.com/" type="button" class="btn btn-primary">Link</a></td>
</tr><tr>
<td colspan="5" class="hiddenRow"><div class="accordian-body collapse" id="123">More Content</div> </td>
</tr>

</tbody>

</table>

一排
第2排
第3排
第4排
第5行
内容1
内容2
内容3
内容4
更多内容

尝试以下方法:-

<a href="http://www.url.com/" onclick= stopEventPropogation(event) type="button" class="btn btn-primary">Link</a>

<script type="text/javascript">
function stopEventPropogation(e){
e.stopPropogation()
}
</script>

您也可以执行非结构化的
$('.accordiontogole')。在('click','.btn',函数(e){e.stopPropagation();})
中,如果您愿意,将其添加到您的答案中。
$('.accordion-toggole').on('click', '.btn', function(e) { e.stopPropagation(); })