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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T16:16:34+00:00 2026-05-12T16:16:34+00:00

You know what I liked best about obtrusive javascript? You always knew what it

  • 0

You know what I liked best about obtrusive javascript? You always knew what it was going to do when you triggered an event.

<a onclick="thisHappens()" />

Now that everybody’s drinking the unobtrusive kool-aid it’s not so obvious. Calls to bind events can happen on any line of any number of javascript file that get included on your page. This might not be a problem if you’re the only developer, or if your team has some kind of convention for binding eventhandlers like always using a certain format of CSS class. In the real world though, it makes it hard to understand your code.

DOM browsers like Firebug seem like they could help, but it’s still time consuming to browse all of an element’s event handler properties just to find one that executes the code you’re looking for. Even then it usually just tells you it’s an anonymous function() with no line number.

The technique I’ve found for discovering what JS code gets executed when events are triggered is to use Safari’s Profiling tool which can tell you what JS gets executed in a certain period of time, but that can sometimes be a lot of JS to hunt through.

There’s got to be a faster way to find out what’s happening when I click an element. Can someone please enlighten me?

  • 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-12T16:16:35+00:00Added an answer on May 12, 2026 at 4:16 pm

    If you’re using jQuery you can take advantage of its advanced event system and inspect the function bodies of event handlers attached:

    $('body').click(function(){ alert('test' )})
    
    var foo = $('body').data('events');
    // you can query $.data( object, 'events' ) and get an object back, then see what events are attached to it.
    
    $.each( foo.click, function(i,o) {
        alert(i) // guid of the event
        alert(o) // the function definition of the event handler
    });
    

    Or you could implement your own event system.

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

Sidebar

Related Questions

I would like to know the best practice about raising an exception without arguments.
I would like to know if there is some best practices about the root
I would like to know what the simplest/best way for obtaining information about the
Colleagues, Preamble. My question is more about best practices. I know one workaround. This
I know about the dependency injection pattern which seems like the best solution available
I would like to know the best way to go about setting up a
i just want to know about the best way to store sensitive and secured
I'd like to know the best way of converting a list of domain object
I'd like to know the best/easiest way to get a visual diff of a
I´d like to know what is the best option to develop an auction site

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.