1

For example, i associate following function with some element

$('table#users tbody tr:first #save').click(function(){ $(this).closest('tr').remove(); }); 

Now, if i don't know where this function is stored, is there a way to view associated with click() code? In above example, i want a way to view that in firebug, or in another way

$(this).closest('tr').remove(); 

If I'm writing in console following, i'm get a link to dom inspector

>>> ($('table#users tbody tr:first #save').click) function() 

but link is for jquery library, not the code i want.

3 Answers 3

2

I think this will answer your question How to find event listeners on a DOM node when debugging or from the JavaScript code?

The reason you get a link to the DOM inspector on the code you wrote is because calling $(selector).click will actually raise the click events and return the result set.

Sign up to request clarification or add additional context in comments.

Comments

1

Try the eventbug plugin for Firebug: http://blog.getfirebug.com/2009/10/30/event-listener-view-for-firebug/

Comments

1

There is also default method of Function object in javascript - toSource

http://www.devguru.com/technologies/ecmascript/quickref/function_object.html

example:

>>> $('.jq-runCode').click.toSource()

"(function (d) {return d ? this.bind(b, d) : this.trigger(b);})"

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.