當我使用.bind來綁定子項和父項的事件時,子項事件可以用返回false來停止事件傳播;但是當我使用委託時,返回false;不會停止事件傳播。如何在使用委託時停止事件傳播?
HTML:
<div class="parent">
<div class="child"></div>
<div class="child"></div>
</div>
JS:
$('.parent').delegate('.child','click',function(e){
alert('child click');
return false;
});
$('.parent').bind('click',function(e){
alert('parent click');
});
可能重複? http://stackoverflow.com/questions/1357118/javascript-event-preventdefault-vs-return-false –