I am trying to prevent the click event being fired when the user click the child or a div.
I have
<div class='test'>
<div class='click1'>
test 1
</div>
<div class='click1'>
test 2
</div>
<div class='click1'>
test 3
</div>
</div>
my jquery
$('.test').click(function(e){
e.stopPropagation(); //doesn't work
alert('click!')
})
I need to register click event to the .test div and I don’t want the alert pops when user clicks the child div.
Are there anyways to do this? Thanks a lot!
UPDATE:
Working demo: http://jsfiddle.net/drDMK/
Or even this:
Working demo: http://jsfiddle.net/drDMK/1/