We would like to know how to stop event bubble to parent.
<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
src='http://code.jquery.com/jquery-1.7.1.js'></script>
<script type='text/javascript'>
$(window).load(function(){<!--from w ww .ja v a 2s .c om-->
$('.divs').bind('click', function(event){
event.stopPropagation();
console.log("clicked " +$(this).text());
});
});
</script>
</head>
<body>
<DIV class="divs" id="parent1">
Dad
<DIV class="divs" id="child1">Kid1</DIV>
<DIV class="divs" id="child2">Kid2</DIV>
</DIV>
</body>
</html>
The code above is rendered as follows: