Gay*_*yan 5 html javascript jquery
我有像这样的HTML代码块
<div id="some-div">
<a href="#" class="link-click">some link text</a>
<div id="small-text">here is the small text</div>
//another text block
</div>
<script type="text/javascript">
$('#some-div').click(function(){//some task goes here});
$('.link-click').click(function(){//some task goes here for link});
$('#small-text').click(function(){//some task goes here for small div});
</script>
Run Code Online (Sandbox Code Playgroud)
当我们点击div(id = some-div)弹出消息时,但当我点击链接(class = link-click)时,我需要运行另一个javascript函数.但事情是,当我点击链接点击它也运行some-div功能.意味着点击两个函数运行.
我如何防止并发JavaScript函数执行.我也在使用jquery.谢谢