1

In a single page application, I load a different html page with jquery.

$('#lodger').click(function () {
    $('#main').load('lodger.html');
});

In my page lodger.html, I have some javascript directly in the page.

Is there a way to debug it? I haven't found a way to do it with Chrome

2 Answers 2

1

The chrome website explains how to debug pretty well:

https://developer.chrome.com/devtools/docs/javascript-debugging

enter image description here

I would refrain from using debugger;. Sooner or later you're going to accidentally leave this bit of code in your script and it'll start pausing your website for users who have dev tools open. Can be very embarrassing.

Sign up to request clarification or add additional context in comments.

1 Comment

jquery load seem to prevent to see js file in this tool... that work if i use debugger;
0

You can use debugger; notation inside your inline code, and, having DevTools opened these breakpoints will automatically be hit:

$('#lodger').click(function () {
    debugger;
    $('#main').load('lodger.html');
});

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.