Using Browser Debugging Tools

Choose a browser tool based on the evidence you need. Checking values and execution order is more useful than making several guesses at once.

ToolUse it to inspect
ConsoleErrors and labelled diagnostic values.
ElementsThe current DOM, classes, attributes, and styles.
Sources / DebuggerExecution and variable values while JavaScript is paused.
NetworkRequest status, response content, and missing resources.
Application / StorageSaved keys and values for the current origin.

Names vary between browsers. Inspect the running page: its DOM may differ from the original HTML after JavaScript updates it.

Pause and inspect

In Chrome, open Sources, locate the script, and select a line number to set a breakpoint. Perform the action that reaches it. Inspect the relevant variables and call stack while execution is paused. Resume when you have the evidence you need. See the Chrome breakpoint referenceopen in new window.

Stepping over advances without entering a called function; stepping into follows its execution; stepping out returns to the caller. A breakpoint helps establish whether a handler ran and where values changed.

Checklist

  • [ ] I selected a tool that matches the problem.
  • [ ] I checked whether the relevant handler runs.
  • [ ] I inspected values before and after the suspected operation.
  • [ ] I checked requests or storage when those features are involved.
  • [ ] I removed temporary breakpoints and restored any offline testing setting.