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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:06:57+00:00 2026-06-04T04:06:57+00:00

When placing a handler to an element via $.on() , is there any way

  • 0

When placing a handler to an element via $.on(), is there any way to find the delegated event when all you have is the target?

EX:

$('body').on('click', '#myLink', function(){ doStuff() });

…

$('#myLink').eventsFromOn();

I know this seems odd, because if the event has the delegate event data, its not really a delegated event anymore, but its worth it to ask…

Thanks!

  • 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-04T04:06:58+00:00Added an answer on June 4, 2026 at 4:06 am

    If you’re looking for handler data, looks like you can find it with undocumented information if you try hard enough. On the undocumented events data object, you have the keys type, handler, and — importantly — selector. So if you start with #mylink, you can look at the events data at each level in its ancestry looking for a match for your desired event where $("#mylink").is(selector) is true.

    For example, with this HTML:

    <body>
      <div id="mylink">click me</div>
    </body>
    

    If I execute

    $("body").on("click", "#mylink", function() {
        // Anything
    });
    

    Then do this:

    var level = $("#mylink");
    while (level[0]) {
      console.dir(level.data('events'));
        level = level.parent();
    }
    

    I get this:

    undefined
      No Properties
    Object
      click: Array[1]
        0: Object
            data: undefined
            guid: 1
            handler: function () {
            namespace: ""
            origType: "click"
            quick: Array[4]
            selector: "#mylink"
            type: "click"
            __proto__: Object
            delegateCount: 1
            length: 1
            __proto__: Array[0]
            __proto__: Object
    undefined
      No Properties

    As you can see, the click hander on body is there, with a selector matching the element #mylink.

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

Sidebar

Related Questions

Is there a generic way of doing it? I want to log all mouse-click
I have a Javascript module the following Javascript: EntryController = function$entry(args) { MainView(); $('#target').click(function()
It appears that the Blur event stops the click event handler from working? I
Im playing about with some very simple windows forms. I have an event handler
Placing an image inside a Span (here : HtmlGenericControl ) programmatically Want to have
Are there benefits to placing ASP.Net code in a separate file?
I find myself placing a lot of divs, images and content in general with
I have encountered a problem of placing data into the Table View. Here is
TL;DR Is PinView.prototype = _.extend(PinView.prototype, google.maps.OverlayView.prototype) the proper way to have a Backbone View
In my adobe AIR application I have registered a global error handler. While debugging

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.