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

  • SEARCH
  • Home
  • 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 3753858
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T09:27:22+00:00 2026-05-19T09:27:22+00:00

With object.stopPropagation() I can stop event bubbling but how can I re-enable it? Is

  • 0

With object.stopPropagation() I can stop event bubbling but how can I re-enable it?

Is there a pre defined function in js something like object.startPropagation?

EDIT:

The Problem is that the JS remembers if you click on the “object” than stop Event Bubbling always even after I don’t want it, so I would like to stop it:

document.getElementById("object").onclick = function(e){
    if(e && e.stopPropagation) {
        e.stopPropagation();
    } else {
          e = window.event;
          e.cancelBubble = true;
    }
}
  • 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-19T09:27:23+00:00Added an answer on May 19, 2026 at 9:27 am

    It doesn’t remember the value at all. The event e is new each time onclick is fired. The problem is you’re always cancelling the event bubbling:

    if(foo) {
        e.stopPropagation();
    } else {
        e.cancelBubble = true;
    }
    
    • e.stopPropagation is the W3C method
      of preventing event bubbling.
    • e.cancelBubble is the Microsoft
      method to prevent event bubbling.

    They’re both the same. So you’re cancelling bubbling of events every time. More reading here.

    You’ll need to change your method so that it only cancels bubbling if your criteria are met:

    document.getElementById("object").onclick = function(e) {
    
        if(e && e.stopPropagation && someCriteriaToStopBubbling === true) 
        {
            e.stopPropagation();
        } 
        else if (someCriteriaToStopBubbling === true)
        {
              e = window.event;
              e.cancelBubble = true;
        }
    }
    

    UPDATE:
    Bear in mind that in your current code, if (e && e.stopPropagation) will always be true if the browser supports stopPropagation. If it goes into the second brace for cancelBubble, it will not remember the value last set. See this fiddle.

    Basically, to summarise, in your code you’re cancelling propagation every time after every click. You have to put some criteria into the function to determine whether or not to cancel the propagation up the element hierarchy.

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

Sidebar

Related Questions

I'm passing this inside an each loop (DOM object) to another function but in
Object A { def a = { something} } // I've import A, but
object_getIvar(id object, Ivar ivar) reads the values of iVArs properly but fails on a
Some object property/array manipulation. Is there better syntax to accomplish part 2 and 3?
jQuery.widget(ui.test,{ _init: function(){ $(this.element).click(this.showPoint); }, showPoint: function(E){ E.stopPropagation(); alert(this.options.dir); } } $('#someEleme').test(); Right now,
I am assigning an event handler function to an element through the native browser
Object cannot be cast from DBNull to other types. I have a following function
object o; Is there any difference between o.ToString() and (string) o ?
Object#to_yaml_properties is a method you can use to list which instance variables you want
Object.prototype.e = function() { [].forEach.call(this, function(e) { return e; }); }; var w =

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.