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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:28:51+00:00 2026-06-05T15:28:51+00:00

The jQuery docs at http://api.jquery.com/on/ mention the benefits of delegated-events using the following syntax

  • 0

The jQuery docs at http://api.jquery.com/on/ mention the benefits of delegated-events using the following syntax (which attaches an event handler to only one element):

$('#mytable').on('click', 'tr.hoverable', function(){
    // blah
});

But I can’t find any reference to proper syntax for attaching multiple events at once WITH delegated-events. Is there a shortcut for the following, but with tr.hoverable as a delegated event?

$('#mytable tr.hoverable').on({
    mouseenter: function(){
        // blah
    },
    mouseleave: function(){
        // blah
    },
    click: function(){
        // blah
    }
});

Or is this the only solution …

$('#mytable').on('click', 'tr.hoverable', function(){
    // blah
}).on('mouseenter', 'tr.hoverable', function(){
    // blah
}).on('mouseleave', 'tr.hoverable', function(){
    // blah
});

?

  • 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-05T15:28:52+00:00Added an answer on June 5, 2026 at 3:28 pm
    $('#mytable').on({
        mouseenter: function(){
            // blah
        },
        mouseleave: function(){
            // blah
        },
        click: function(){
            // blah
        }
    }, '.hoverable');
    

    As per this signature:

    .on( events-map [, selector] [, data] )

    Also, prefer single tagName/className/id selectors for delegation as they get optimized

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

Sidebar

Related Questions

Im using jQuery's validation which can be found here: http://docs.jquery.com/Plugins/Validation/rules#.22add.22rules I currently have some
I'm using jquery tabs ( http://docs.jquery.com/UI/API/1.7.2/Tabs ). Jquery version 1.3.2 and Jquery UI version
I'm using a jQuery plugin called qTip (http://craigsworks.com/projects/qtip/docs/api/#callbacks) and trying to implement a callback
In the jQuery docs for the load event http://api.jquery.com/load-event/ , it says Can cease
Here's an example taken from http://docs.jquery.com/API/1.1/AJAX#.24.post.28_url.2C_params.2C_callback_.29 $.ajax({ type: POST, url: some.php, data: name=John&location=Boston, success:
I'm using the JQuery tooltip plugin - http://docs.jquery.com/Plugins/Tooltip With the basic implementation: $(.tooltip).tooltip(); Instead
jquery says: http://docs.jquery.com/JQuery_Core_Style_Guidelines#RegExp All RegExp operations should be done using .test() and .exec(). string.match()
I'm using this dialog: http://docs.jquery.com/UI/Dialog To open dialog I do it this way: $('a.openModal').live(click,
http://docs.jquery.com/UI/Spinner The demos in the doc reference the following javascript file: http://jquery-ui.googlecode.com/svn/tags/1.6rc2/ui/ui.core.js However, when
I am using jQuery.ajax ( http://docs.jquery.com/Ajax/jQuery.ajax ) to inject the contents of a different

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.