returning false to the event handler does two things:
If you have an anchor tag, this will prevent anchor from linking
It will stop the propagation of the event (bubbles). for instance
< div id='outer' onclick="alert('hello')" >
< div id='inner'>
< /div>
< /div>
and
$("#inner").click(function(event){
return false
})
If your function returns false, alert("hello")it will not be called when someone clicks the inner div. Return false matches the call
event.preventDefault();
event.stopPropagation();
A word of warning, this behavior only works with jquery
event.preventDefault () vs. return false
Source: John Resig
source
share