Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8347889
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T07:30:55+00:00 2026-06-09T07:30:55+00:00

I don’t have an example at hand, but in some situations calling event.preventDefault() lets

  • 0

I don’t have an example at hand, but in some situations calling event.preventDefault() lets the original event through (navigating to page, submitting form etc) but returning false helps. What could cause this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T07:30:57+00:00Added an answer on June 9, 2026 at 7:30 am

    You don’t have an example to hand? OK, let me invent one that may or may not be whatever it was you were thinking of.

    Remember that return false; is the equivalent of calling both event.preventDefault(); and event.stopPropagation(). EDIT: This applies with jQuery, which explictly implements this behaviour and also normalises event.preventDefault() and event.stopPropagation() for use in all browsers. It doesn’t work that way in all browsers with “plain” JS, in fact older IE versions don’t support event.preventDefault() at all, they have their own equivalent event.returnValue = false;

    If you have nested elements and you handle the same event in several levels then calling event.preventDefault() will not stop the outer elements’ event handlers from running, but return false will because it stops propagation of the event.

    An example that demonstrates it: http://jsfiddle.net/nnnnnn/KjLv3/

    <a href="#"><span>Click me to see an alert</span></a>
    
    // using jQuery for simplicity in the example:
    
    $("a span").click(function(e){
        e.preventDefault();
    });
    
    $("a").click(function() {
        alert("Hello");
    });
    

    The alert will display. If you change the “a span” handler to return false the alert will not display.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Don't ask me how but I'm in a situation where I have DCPs published
Don't they both have to convert to machine code at some point to execute
Don't have much to say, just can get into the event handler. XAML: <Grid>
Don't ask why but I have the requirement to draw a border around certain
DON'T ASK WHY but... I have a regex that needs to be case insensitive
Don't know why but I can't find a solution to this. I have 3
Don't ask how I got there, but I was playing around with some masking,
don't know better title for this, but here's my code. I have class user
don't know if the title describes anything about what I'm trying to say but
don't know what happened in my jcrop selection. I think I pressed some keys

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.