I wonder if anybody else is having this issue. I’m using Firefox 4 and I’m debugging a function from an onclick event using Firebug. Now, to be sure, I checked the stack and it clearly shows that an onclick event was fired. However, when I type “event” (without quotse) in the watch pane, it says it’s undefined. Why? Now it recognizes “Event”, but not “event”. Is anybody else having this issue?
Thank you.
When debugging inside of your event function, add a watch for
arguments[0]; this is the event object you are looking for.Modern, standards-compliant browsers don’t use a
window.eventobject in the manner that some versions of Internet Explorer do.In these browsers, the event is passed to the event handler as an argument. So if you do something like the following…
…then when
#myElementis clicked, the browser will executefoo(bar), wherebaris the event object. If you need to see the event object’s details, you would have to set a breakpoint inside offooand add a watch forbaror forarguments[0].