1

How do I tell the Chrome developer tools that I'm done live-editing a section of javascript, and want the result to be "evaluated"?
Editing the javascript on the fly is simple, I simply put the cursor somewhere in a script in the Scripts tab and start typing, but how do I finish the editing process?

I read here that "changes you apply to the code are expressed only at the time when execution passes through them", but even if I try editing a function when it's being called (i.e., when having a hit breakpoint inside it), I can't get my changes to be acknowledged. Edit: this whole, "execution passes through it" stuff seems false or out of date at best.

Editing javascript on the fly in the developer tools is demoed by Paul Irish in this video around 3:30, but I can't figure out how he goes from editing code, to having it actually be used by the browser.

Community
  • 1
  • 1
Protector one
  • 6,926
  • 5
  • 62
  • 86

3 Answers3

0

Ctrl+S or "right-click > Save".
Make sure you haven't enabled pretty-print, as you can't live-edit code, then.

Protector one
  • 6,926
  • 5
  • 62
  • 86
0

This is what you are looking for:

1.- Navigate to the Source tab and open the javascript file

2.- Edit the file, right-click it and a menu will appear: click Save and save it locally.

In order to view the diff or revert your changes, right-click and select the option Local Modifications... from the menu. You will see your changes diff with respect to the original file if you expand the timestamp shown.

More detailed info here: http://www.sitepoint.com/edit-source-files-in-chrome/

artemisian
  • 2,976
  • 1
  • 22
  • 23
0
  • Go to sources, choose the file you want.
  • Click the pause button to pause debugging .
  • Modify the script adding a console.log or whatever you want, wherever you want
  • Save the file (cmd-s or ctrl-2)
  • Click the pause/resume button to resume execution
  • the modified code will be executed
akmur
  • 1,465
  • 2
  • 24
  • 37