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
  • 21,907
  • 7
  • 45
  • 72
chuckfinley
  • 2,527
  • 10
  • 30
  • 41

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
  • 11,924
  • 3
  • 52
  • 60