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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:29:15+00:00 2026-05-16T23:29:15+00:00

Consider this code : HTML: <div class=’a’>a</div> <div class=’b’>b</div> <div id=’log’></div> CSS: .a, .b

  • 0

Consider this code:

HTML:

<div class='a'>a</div>
<div class='b'>b</div>
<div id='log'></div>

CSS:

.a, .b {
    width: 100px;
    height: 100px;
    border: 1px solid black;
    position: absolute;
    text-align: right;
}
.a {
    left: 100px;
    top: 100px;
}
.b {
    left: 150px;
    top: 150px;
}

JS:

$('*').click(function(e) {
    log(this.nodeName + ' ' + this.className);
});

function log(s) {
    $('#log').append(s + '<br />');
}

If the intersection is clicked, .click() for .a is not called.

Is there any built-in method to force the execution of click() for all elements, and not only the top one and its parents, or I must implement this myself ?

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

    I think that the behavior you are observing is correct. When clicking the topmost element the one beneath won’t get a click event despite it looks it is in the “clicked” area. As a workaround you can manually trigger it’s click event:
    $('.a').click().

    Calling click without arguments is equivalent to trigger('click') which raises the specified event. You can find more info in the trigger help topic.

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

Sidebar

Related Questions

Consider the following code : HTML: <div id='button' class='enabled'>Press here</div> <div id='log'></div> CSS: #button
Consider the following code : HTML: <div class='a'></div> <div class='b'></div> CSS: body { position:
Consider the following code: <html> <head></head> <body> <div id='test' class='blah'> <a href='http://somesite.com/' id='someLink'>click!</a> </div>
consider this html code <textarea> <object> <embed></embed> <div></div </object> </textarea> If i issue the
Consider this HTML: <!DOCTYPE html> <html> <head> <title></title> <style type=text/css> div { position: relative;
Please, consider this code: <script> $(function(){ $('#clickme').click(function(){ $('#note_pag').html('<div id=note_pag><ul><li><b>1</b></li><li><a href=2>2</a></li></ul></div>'); }); $('#note_pag a').click(function(){ alert($(this).attr('href'));
Consider this HTML: <div id=entry-content> <div id=my-300px-ad>AD CODE HERE</div> <p><img src=file.jpg alt=file /></p> <p>SOME
Consider the following piece of code: HTML: <div> <img src=http://placehold.it/600x150 /> </div> CSS: div
How to add html tags according to the div width? Php code to output
Consider the following HTML structure: <div class=content> <div class=field field-type-date field-field-event-date> <div class=field-items> <div

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.