How to 'add watch' in Chrome developer tools?

天涯浪子 提交于 2019-12-04 20:13:58

问题


I can't seem to find a way to add a watch expression for the selected JavaScript text in Chrome developer tools, the same way I would in Firebug with Ctrl+W. Is there really no way to do this in Chrome? I can't even right-click the selection as it unselects as soon as I do it, and there is no "Add watch" context menu item. Do I really have to type in every watch I want to add while debugging JS?


回答1:


You can do it by clicking 'add to watch' after right clicking

You can also select the expression/variable and hit Ctrl + Shift + A




回答2:


According to Chrome DevTool Docs - Watch variables in Sources, you can do it in 1 of 3 ways:

  1. Highlight text, right click and choose "Add selected text to watches"
    • Note: this used to be "Add to watch"
  2. Highlight text and press Ctrl + Shift + A
  3. Add from the watch panel directly in the top right corner of the sources tab




回答3:


You need to double click the variable name, then right click will reveal the add to watch option.



来源:https://stackoverflow.com/questions/27247350/how-to-add-watch-in-chrome-developer-tools

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!