Organizational Research By

Surprising Reserch Topic

whats the difference between e preventdefault and return false


whats the difference between e preventdefault and return false  using -'$("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.'

    This question already has an answer here:
    
        
            event.preventDefault() vs. return false
                
                    9 answers

asked Oct 13, 2015 by rajesh
edited Oct 15, 2015 by rajesh
0 votes
13 views



Related Hot Questions

1 Answer

0 votes

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.

answered Oct 13, 2015 by tseetha

...