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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:23:33+00:00 2026-06-17T19:23:33+00:00

I have an element #foo and it has click event on it. Element #foo

  • 0

I have an element #foo and it has click event on it. Element #foo is in element #bar which also has click event on it.

<div id="bar">
  <div id="foo" />
</div>

When #foo is clicked, #bar event gets called and #foo event gets ignored. That’s now what I want.

I’m looking for a way to remove all click events from #foo element except my just set event and all events that are on parents for #foo.

Edit: Here is jsFiddle demo. I want 2nd event to get called before 1st event.

Edit #2: Here is my code with your suggestions. Doesn’t work.

  • 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-17T19:23:34+00:00Added an answer on June 17, 2026 at 7:23 pm

    If you have a click event on foo and you dont want it to bubble you could do the following:

    $("#foo").on('click', function(e){
         e.preventDefault();
         e.stopPropagation(); //this line will stop the click bubbling up the tree.
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have DIV element which only has a few lines in and a background
Say you have this div: <div id="foo">bar</div> And you do this: $("#foo").click(someFunction); somewhere inside
I have number of drop down menu's which gets called with a onClick event
I have code which parses XML that looks like this: <custom_fields> <custom_field> <column_name>foo</column_name> <column_value>0</column_value>
I have a text file which has the following structure: 341|18 Hello world|20090225230048AAnhStI|90|$0.30|10|289|2|2|2|Is that
I have a list of classes that extend the same superclass, which has a
How to select next n hidden elements that have class foo using jQuery?
I have an element in a window in a web page, which I am
I have an element which may contain very big amounts of data, but I
If have an element that maybe disabled on a page, and would like to

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.