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 4612248
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:22:39+00:00 2026-05-22T01:22:39+00:00

They seem to be doing the same thing… Is one modern and one old?

  • 0

They seem to be doing the same thing…
Is one modern and one old? Or are they supported by different browsers?

When I handle events myself (without framework) I just always check for both and execute both if present. (I also return false, but I have the feeling that doesn’t work with events attached with node.addEventListener).

So why both? Should I keep checking for both? Or is there actually a difference?

(I know, a lot of questions, but they’re all sort of the same =))

  • 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-05-22T01:22:40+00:00Added an answer on May 22, 2026 at 1:22 am

    stopPropagation prevents further propagation of the current event in the capturing and bubbling phases.

    preventDefault prevents the default action the browser makes on that event.

    Examples

    preventDefault

    $("#but").click(function (event) {
      event.preventDefault()
    })
    $("#foo").click(function () {
      alert("parent click event fired!")
    })
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
    <div id="foo">
      <button id="but">button</button>
    </div>

    stopPropagation

    $("#but").click(function (event) {
      event.stopPropagation()
    })
    $("#foo").click(function () {
      alert("parent click event fired!")
    })
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
    <div id="foo">
      <button id="but">button</button>
    </div>

    With stopPropagation, only the button‘s click handler is called while the div‘s click handler never fires.

    Where as if you use preventDefault, only the browser’s default action is stopped but the div’s click handler still fires.

    Below are some docs on the DOM event properties and methods from MDN:

    • event.cancelBubble
    • event.preventDefault()
    • event.returnValue
    • event.stopPropagation()

    For IE9 and FF you can just use preventDefault & stopPropagation.

    To support IE8 and lower replace stopPropagation with cancelBubble and replace preventDefault with returnValue

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

Sidebar

Related Questions

They both seem to fulfill the same purpose. When would I chose one over
I'm in a new contract where they seem to have gone overboard with Agile,
I'm looking at buying a code-signing certificate from Comodo (they seem to be the
I have a xsl file that is grabbing variables from xml and they seem
I've been playing with the .NET built in localization features and they seem to
Is there a difference between NULL and null in PHP? Sometimes they seem to
I hear logarithms mentioned quite a lot in the programming context. They seem to
I've just started learning linq and lambda expressions, and they seem to be a
I'm a big fan of TFS, but unfortunately they seem to have omitted any
They both seem to be sending data to the server inside the body, so

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.