简体   繁体   中英

Chrome Dev Tools - Can you undo changes in the console?

If you enter a command in Chrome Dev tools (which could be one big block of code) and hit enter, is there a way to "undo" changes made to the DOM? Or do you simply have to refresh the page?

I too was looking for an answer to this question beyond "refresh the page"... Stumbled across this solution:

  1. Enter Chrome dev tools (CMD + Shift + I on Mac)

  2. Click the three dots aligned vertically to get the settings menu

  3. Hover over "More Tools" then go to "Changes"

  4. On the changes window you can see all the changes made during your current DOM editing session - to revert them all, simply click the undo arrow in the bottom left...

See the visual below

Reset all changes made in Chrome dev tools

Depends on what that code actually does. For example if you change something in the style (css) or structure (html), if you refresh it will show the original page. But if that code changes a cookie value, refreshing is not enough, or even closing the browser and opening again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM