Javascript Debugging line by line using Google Chrome

前端 未结 2 1721
梦谈多话
梦谈多话 2020-11-27 11:09

How can I step through my javascript code line by line using Google Chromes developer tools without it going into javascript libraries?

For example, I am heavily usi

2条回答
  •  有刺的猬
    2020-11-27 11:57

    Assuming you're running on a Windows machine...

    1. Hit the F12 key
    2. Select the Scripts, or Sources, tab in the developer tools
    3. Click the little folder icon in the top level
    4. Select your JavaScript file
    5. Add a breakpoint by clicking on the line number on the left (adds a little blue marker)
    6. Execute your JavaScript

    Then during execution debugging you can do a handful of stepping motions...

    • F8 Continue: Will continue until the next breakpoint
    • F10 Step over: Steps over next function call (won't enter the library)
    • F11 Step into: Steps into the next function call (will enter the library)
    • Shift + F11 Step out: Steps out of the current function

    Update

    After reading your updated post; to debug your code I would recommend temporarily using the jQuery Development Source Code. Although this doesn't directly solve your problem, it will allow you to debug more easily. For what you're trying to achieve I believe you'll need to step-in to the library, so hopefully the production code should help you decipher what's happening.

提交回复
热议问题