43
$("a.avatar").click(function(e){
      e.preventDefault();
      $("#thumbnails").fadeIn();
    });

and

$("a.avatar").click(function(e){
      $("#thumbnails").fadeIn();
          return false;
    });

Both can achieve the same goal for me.

user198729
  • 61,774
  • 108
  • 250
  • 348

1 Answers1

49

Returning false from jQuery event handlers is equivalent to calling both, e.preventDefault and e.stopPropagation.

So the difference is that preventDefault will only prevent the default event action to occur, i.e. a page redirect on a link click, a form submission, etc. and return false will also stop the event flow.

Christian C. Salvadó
  • 807,428
  • 183
  • 922
  • 838