Jquery 如何使父Div中的链接不切换
当单击父div“.row”以显示更多内容“.ExpandPane”时,我有以下代码来切换列表中的元素。但是,当单击父div“.row”中的链接时,它们也会激活切换功能 有没有办法解决这个问题?我希望能够单击父div“.row”中的任意位置,但允许父div“.row”中的链接正常运行,而不激活切换功能 HtmlJquery 如何使父Div中的链接不切换,jquery,html,Jquery,Html,当单击父div“.row”以显示更多内容“.ExpandPane”时,我有以下代码来切换列表中的元素。但是,当单击父div“.row”中的链接时,它们也会激活切换功能 有没有办法解决这个问题?我希望能够单击父div“.row”中的任意位置,但允许父div“.row”中的链接正常运行,而不激活切换功能 Html stopPropagation()防止事件冒泡到父div。而且,这个问题已经回答了大约100次了 <div class="Row"> <a class="accep
stopPropagation()
防止事件冒泡到父div。而且,这个问题已经回答了大约100次了
<div class="Row">
<a class="acceptBtn"></a>
<p>content.....</p>
<div class="ExpandPane"></div> <!-- hidden -->
</div>
<div class="Row">
<p>content...</p>
<a class="acceptBtn"></a>
<div class="ExpandPane"></div><!-- hidden -->
</div>
<div class="Row">
<p>content....</p>
<a class="acceptBtn"></a>
<div class="ExpandPane"></div><!-- hidden -->
</div>
$(".Row").toggle(
function () {
$(this).find('.ExpandPane').show();
//$(this).find('.PhotoShow').hide();
//$(this).find('.PhotoHide').show();
},
function () {
$(this).find('.ExpandPane').hide();
//$(this).find('.PhotoHide').hide();
//$(this).find('.PhotoShow').show();
});
$(".acceptBtn").click(function(event) {
alert("hi");
});
$(".acceptBtn").click(function(event) {
alert("hi");
event.stopPropagation();
});