-1

Is there a way I can attach the debugger to an event?

I have a checkbox input element in my DOM and when it's clicked, I'd like the debugger to break so I can step through what's happening. I've added onclick="debugger; ...", but Firebug doesn't break.

1

2 Answers 2

2

Create an onclick handler for the checkbox, and add a breakpoint to that handler. For example (jQuery):

$('input#mycheckbox').click(function() {
 console.log("click checkbox");
});

In firebug you can add a breakpoint to the console.log line.

answered Nov 25, 2009 at 23:08
Sign up to request clarification or add additional context in comments.

Comments

1

Find the javascript line in firebug and set a breakpoint. You should'nt need to modify your Javascript at all.

Check out this page, specifically the "Pause execution on any line" section to see what this looks like visually.

answered Nov 25, 2009 at 23:05

2 Comments

Well that's the thing--there is no JavaScript line.
Then set a breakpoint on the first line of the event handler.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.