JQuery provides two ways to prevent events from bubbling.
Method 1: event.stopPropagation();
$("#div1").mousedown(function(event){
event.stopPropagation();
});
Method 2: return false;
$("#div1").mousedown(function(event) {
return false;
});
But there is a difference between these two methods. Returning false not only prevents the event from bubbling up, but also prevents the event itself.
event.stopPropagation() only prevents the event from bubbling up, but does not prevent the event itself.