How do I debug Javascript which was loaded via AJAX (specifically jQuery)

前端 未结 4 2048
既然无缘
既然无缘 2020-12-12 21:42

I have changed my coding style with more complex projects to loading pages (And their embedded scripts) \"on demand\" recently. However, it is difficult to debug those scrip

4条回答
  •  无人及你
    2020-12-12 22:29

    Add this to your js files where you want it to break:

    debugger;
    

    Then step into/over/out like any other debugger.

    Works for dynamically loaded scripts and pages. Only works in Chrome as far as I know.

提交回复
热议问题