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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T13:55:57+00:00 2026-06-16T13:55:57+00:00

Possible Duplicate: test if event handler is bound to an element in jQuery Tried

  • 0

Possible Duplicate:
test if event handler is bound to an element in jQuery

Tried to do the following (link is jQuery object of ‘a’ tag):

 link.data("events") //undefined even if link has event handlers
 jQuery.data(link, 'events') //undefined always also
 jQuery._data(link, 'events') //undefined always also

using jquery-1.8.3

So, how to check if element has click handler?

  • 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-16T13:55:58+00:00Added an answer on June 16, 2026 at 1:55 pm

    You can use jQuery._data to check for events. The first argument should be a reference to the HTML element, not the jQuery object.

    var ev = $._data(element, 'events');
    if(ev && ev.click) alert('click bound');
    

    Sample below.

    $(function(){
        $('#test').click(function(){
            // NOTE: this below is refering to the HTML element, NOT the jQuery element
            var ev = $._data(this, 'events');
            if(ev && ev.click) alert('click bound to this button');
        });
    });
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
    <button id="test">Click me to check for click handlers</button>

    Also note that this method for checking events will only work when the event is bound via jQuery. If the event is bound via element.attachEventListener, element.onclick, <a onclick="doStuff()"> or any other non jQuery way, this will not work. If you’re fitting into this boat, check this answer.

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

Sidebar

Related Questions

Possible Duplicate: jQuery test for whether an object has a method? I want to
Possible Duplicate: How do I test for an empty Javascript object from JSON? var
Possible Duplicate: Absence of property syntax in Java See the following situation: class Test
Possible Duplicate: jQuery Event Keypress: Which key was pressed? I'm using below code to
Possible Duplicate: How do I determine an HTML input element type upon an event
Possible Duplicate: Select inner text (jQuery) I have a span: <span class=test> target_string </span>
Possible Duplicate: javascript test for existence of nested object key I'm attempting to construct
Possible Duplicate: jQuery - Click event doesn’t work on dynamically generated elements I just
Possible Duplicate: Interesting test of Javascript RegExp Regular expression test can't decide between true
Possible Duplicate: Calling Python from JavaScript I have a test.py and test.js . I

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.