我想要做的是阻止点击div,如果用户点击该div内的链接.但是没有使用.click(function(){}); 在链接上.
这是代码:
$('div.feature').click(function() { window.location = $(this).attr('rel');});
Run Code Online (Sandbox Code Playgroud)
这是div的示例内容:
<div id="feature" rel="urlnumberone">
some text
<a href="javascript:topicchange(this);" class="insideLink">Link</a>
</div>
Run Code Online (Sandbox Code Playgroud)
由于某些特定原因,我不能使用这样的东西
$('.insideLink').click(function(event){
event.stopImmediatePropagation();
});
Run Code Online (Sandbox Code Playgroud)
我必须使用这个"topicchange()"函数,有什么方法可以阻止事件传播?
谢谢!