i have html code block like this
<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>
when we click on the div(id=some-div) popup message coming but when i click on the link(c开发者_运维问答lass=link-click) i need to run another javascript function. but the thing is when i click on link-click it also runs some-div function too. means on click both function gets run.
how do i prevent concurrent javascript function execution. i'm using jquery too. thanks
You could use event.stopPropagation() to avoid having the event bubbling up the DOM tree.
$('.link-click').click(function(e){
e.stopPropagation();
});
精彩评论