Nok Imchen
Nok Imchen

Reputation: 2842

How to debug an event listener in Firebug?

I would like to execute every code step by step after the debugger keyword in Firebug. In the following example JSFiddle the execution halts when the form is clicked because of the debugger keyword in the onclick attribute. Subsequently I click Step Into in Firebug but instead of showing the jQuery code, it shows nothing... How to make Firebug halt at the jQuery code?

<form method="get" onclick="debugger">
    <input type="text" name="q" value="">
    <input type="submit" value="Search Google">
</form>

jQuery code:

$('form').submit(function() {
    document.title = "How to shown this line in debugger?";
    return confirm('Are you sure you want to search Google?');
});

Upvotes: 1

Views: 425

Answers (1)

Patrick Evans
Patrick Evans

Reputation: 42736

For Firebug

  1. Go to the Script panel

  2. Click the dropdown for the scripts and select the script you need

  3. Add a breakpoint on the line you want to start debugging from

For Chrome

  1. Go to the console
  2. Then to the Sources tab

  3. Click "show navigator" button

  4. Select the script

  5. Click the line number you wish to debug from

Upvotes: 3

Related Questions