event.preventDefault() vs. return false

Explanation

Difference between event.preventDefault() and return false is :

return false is effective in calling both e.preventDefault() and e.stopPropagation() on the passed jQuery.Event object. 

Where as event.preventDefault() is use to prevent the event from occurring. And also e.stopPropagation() will prevent the event from bubbling up.

And return false can do this both things. 

 

Also read, Does Python have a ternary conditional operator?

 

Share this post

Leave a Reply

Your email address will not be published. Required fields are marked *