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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T23:18:25+00:00 2026-05-14T23:18:25+00:00

Having a nightmare trying to figure out event Bubbling.. Full test case : <html>

  • 0

Having a nightmare trying to figure out event Bubbling..

Full test case:

<html> 
<head> 
<script type="text/javascript"> 
function $(ob) { return document.getElementById(ob) }

function bodyClick()
{
  $('win_clicks').value = parseInt($('win_clicks').value) + 1;
}

window.addEventListener('load',function(e)
{
  $('bl_lnk').addEventListener('click',function (e)
  {
    $('bl_lnk_clicks').value = parseInt($('bl_lnk_clicks').value) + 1;
  }, true);

  $('rd_lnk').addEventListener('click',function (e)
  {
    $('rd_lnk_clicks').value = parseInt($('rd_lnk_clicks').value) + 1;
  }, false);

}, false);
</script>
</head>

<body onclick="bodyClick();" style="font:16px Tahoma"> 

<div id="bl_lnk" style="position:absolute; width:250px; top:100px; left:50%; margin-left:-125px; padding:20px; background:#AAFFFF; border:1px solid #55AAFF; text-align:center; cursor:pointer">
  I'm a link, Click me! &nbsp; &nbsp; &nbsp; &nbsp; and me!
</div>

<div id="rd_lnk" style="-moz-border-radius:40px; border-radius:50px; position:absolute; width:60px; height:40px; top:103px; left:50%; margin-left:77px; padding:5px; border:3px solid #FF6666; cursor:pointer"></div> 

<div style="position:absolute; width:250px; top:200px; left:50%; margin-left:-125px; padding:20px; background:#fff6bf; border:1px solid #FFD324;">
  <table cellspacing="10"> 
    <tr>
      <td>Blue Link Clicks:</td>
      <td><input type="text" id="bl_lnk_clicks" value="0" style="width:35px; border:0; background:transparent" /></td>
    </tr>
    <tr>
      <td>Red Link Clicks:</td>
      <td><input type="text" id="rd_lnk_clicks" value="0" style="width:35px; border:0; background:transparent" /></td>
    </tr> 
    <tr>
      <td>Body Clicks:</td>
      <td><input type="text" id="win_clicks" value="0" style="width:35px; border:0; background:transparent" /></td>
    </tr> 
  </table>
</div> 

</body> 
</html> 

From what I understand clicking in the area inside the red border should trigger all 3 event handlers (red, blue & body), only red and body are triggered..

I have tried altering the third value of addEventListener and changing the return values but to no avail, any ideas?

  • 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-14T23:18:26+00:00Added an answer on May 14, 2026 at 11:18 pm

    The red div should be inside (structurally in your HTML, not visually) for the event to propagate to the blue div.

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

Sidebar

Related Questions

I am having a nightmare trying to debug the event receiver of a Sharepoint
I am having a nightmare of a time trying to label data with pyplot.
Hi guys just a quick question, After having a nightmare trying to get an
I'm having a bit of a nightmare trying to get REE playing nicely with
I am having a nightmare, been trying all day with this, and searched google
I'm having a nightmare trying to get some quotes to loop with a delay.
I am having a nightmare trying to get this working (and have looked at
I am having a nightmare trying to extend the admin emails in wp ecommerce
I'm having an absolute nightmare trying to setup a custom TLD domain with github
I'm having a nightmare with LINQ. I've got a table of Projects, and each

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.