Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chrome javascript debugger breakpoints are not working

Whether I set breakpoints directly on the source/console or add a debugger on my code, the browser doesn't seem to respond to them. Any ideas why? Here's my code:

 if (select[i].placeholder != undefined && select[i].placeholder != '' ) {
        selected.appendChild(document.createTextNode(select[i].placeholder)); debugger;
    } else if (select[i].options[0].value == '' && select[i].options[0].textContent != '' ) {
        selected.appendChild(document.createTextNode(select[i].placeholder));
    } else {
        selected.appendChild(document.createTextNode('Select an option'));
    }
like image 382
John the User Avatar asked Jan 04 '17 11:01

John the User


People also ask

Can you use breakpoints in JavaScript?

In the debugger window, you can set breakpoints in the JavaScript code. At each breakpoint, JavaScript will stop executing, and let you examine JavaScript values. After examining values, you can resume the execution of code (typically with a play button).


2 Answers

In Dev Tools, on the Sources panel, there's a button that looks like a breakpoint marker with a line through it: That button disables all breakpoints. To re-enable them, click the button.

Here's what it looks like when they are currently enabled (clicking it disables them):

enter image description here

...and when they are currently disabled (clicking it enables them):

enter image description here

like image 166
T.J. Crowder Avatar answered Sep 20 '22 15:09

T.J. Crowder


Restarting the app worked for me.

like image 22
Itay Tur Avatar answered Sep 22 '22 15:09

Itay Tur