1. Javascript: Difference between “return false” and “e.preventDefault()”

    Most of the times we just write

    return false;

    or we write

    e.preventDefault()

    to stop from executing href element in an anchor tag.

    return false; just stops the propagation and e.preventDefault() makes the default behavior execution of a tag.

    In simple words:

    equivalent to return false; is

    e.preventDefault();

    e.stopPropagation();

     
  2. Jul 9th, 2010     javascript
blog comments powered by Disqus