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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T14:46:16+00:00 2026-05-22T14:46:16+00:00

This is a simplified excerpt from the DOM: <td> <button value=11 class=expand ui-button ui-widget

  • 0

This is a simplified excerpt from the DOM:

<td>
    <button value="11" class="expand ui-button ui-widget ui-state-default ui-corner-all ui-button-icon-only" role="button" title="">
        <span class="ui-button-icon-primary ui-icon ui-icon-plus"></span>
        <span class="ui-button-text"></span>
    </button>
</td>

This is repeated for every row in the table (~500), and the table has an ID of ‘eventTable’

Here’s the button instantiation (jQueryUI):

$('.expand').each(function(){
    $(this).button({
        text: false,
        icons: {
            primary: "ui-icon-plus"
        }
    });
});

Here’s a part of the event delegation on table #eventTable

$('#eventTable').click(function(e){
    if($(e.target).is('.expand'){
        // ...

Now, in Firefox 3.6.x, IE7,8, this works and steps into the if statement. In Safari and Chrome, however, e.target represents the first span instead of the surrounding button.

Why is this happening? I can work past it, but I would love an explanation so I don’t run into the same problem later in a different scenario. Why is Webkit right and Trident/Gecko wrong? What caused the difference?

  • 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-22T14:46:17+00:00Added an answer on May 22, 2026 at 2:46 pm

    Posting my comment as an answer.

    If you’re just wary not to get a ton of click handler references on your DOM, I’d suggest you use .delegate() instead. It “binds” only one handler onto a context, and checks if the event target matches a selector you provide, and fires off the handler if it does.

    Something like

    $('#eventTable').delegate('click', '.expand', function() {
        // click on the .expand element/s
    });
    

    should suffice.

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

Sidebar

Related Questions

I am using the jQuery plugin from the jQuery build of TinyMCE. This simplified
Imagine this simplified markup: <div id=header> <!-- Other things.... --> <div id=detail> </div> </div>
I have code like this (simplified): def outer(): ctr = 0 def inner(): ctr
I have a table like this (simplified): ID | Name | Parent --------------------------------- 1
I'm starting out with some XML that looks like this (simplified): <?xml version=1.0 encoding=UTF-8?>
Just created an acc on SO to ask this :) Assuming this simplified example:
I've got 3 tables that are something like this (simplified here ofc): users user_id
In a code review, I stumbled over this (simplified) code fragment to unregister an
I've got a table of student information in MySQL that looks like this (simplified):
I have a multi-table query, similar to this (simplified version) SELECT columns, count(table2.rev_id) As

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.