About 2,850,000 results
Open links in new tab
  1. javascript - How and when to use preventDefault()? - Stack Overflow

    Jul 1, 2013 · From this tutorial, it is said:. preventDefault(); does one thing: It stops the browsers default behaviour. I searched online for the examples of preventDefault(), I can only see in two …

  2. javascript - preventDefault () on an <a> tag - Stack Overflow

    event.preventDefault(); event.stopPropagation(); Stops callback execution and returns immediately when called. So in this type of situation, you should really only use …

  3. javascript - How to prevent default event handling in an onclick …

    Aug 14, 2011 · To create maintainable code, however, you should abstain from using "inline Javascript" (i.e.: code that's directly within an element's tag) and modify an element's behavior …

  4. javascript - When to use PreventDefault( ) vs Return false? - Stack ...

    May 27, 2015 · Simply it depends on what you want to accomplish. Use preventDefault(); if you want to “just” prevent the default browser behaviour. Use return false; when you want to …

  5. javascript - How to prevent default on form submit? - Stack Overflow

    Jul 17, 2013 · If I do this I can prevent default on form submit just fine: document.getElementById('my-form').onsubmit(function(e) { e.preventDefault(); // do …

  6. javascript - What's the difference between event.stopPropagation …

    event.preventDefault() prevents the default browser behavior for a given element. In form element it prevents form submitting and for href element it prevents navigating. …

  7. Plain JavaScript version of e.preventDefault (); - Stack Overflow

    Oct 4, 2013 · @Ricardo: This answer states that return false; is equivalent to calling both e.preventDefault() and e.stopPropagation(). While that's true for jQuery's non-standard event …

  8. javascript - event.preventDefault() vs. return false - Stack Overflow

    Aug 31, 2009 · e.preventDefault() will prevent the default event from occuring, e.stopPropagation() will prevent the event from bubbling up and return false will do both. Note …

  9. jQuery - How to use e.preventDefault(); in a JavaScript function

    Mar 2, 2011 · // e.preventDefault(); }); The "elementData" variable will end up (in this case, anyway) being an array with two values in it, "data1" and "data2". You can give JSON-notation …

  10. Submit form after calling e.preventDefault () - Stack Overflow

    @JamesNZ - I'm positive it's safe. In a heavily Ajax based site race conditions may be a problem if there are multiple Ajax requests made before the responses come back, because there's no …

Refresh