0

How do I force a breakpoint in JavaScript code on event (i.e. on button click) ?

I am using Google Chrome.

Are there any browser compatibility issues that might come with it?

Nope
  • 22,147
  • 7
  • 47
  • 72
chuckfinley
  • 2,577
  • 10
  • 32
  • 42

1 Answers1

3

Set up a button click listener and call the debugger;

Example

$("#myBtn").click(function() {
 debugger;   
});

Demo

http://jsfiddle.net/hBCH5/

Resources on debugging in JavaScript

martynas
  • 12,120
  • 3
  • 55
  • 60