Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to modify javascript code at run time?

Tags:

Is there a way to modify JavaScript code while debugging? Visual Studio has "Edit and Continue", and similar hot swapping of code can be done in Java and other languages. Can this be done with JavaScript, and if so, how?

like image 518
theninjagreg Avatar asked Sep 08 '11 04:09

theninjagreg


People also ask

How do I modify JavaScript?

After loading a web page completely, press the F12 key to open the developer tools, then open the 'Sources' tab. Now open any Javascript file loaded on the browser and you can directly edit it by clicking anywhere in that file. After making modifications press Ctrl+S to save the changes.

How do I edit JavaScript in IE developer tools?

Our first experiment in the latest build allows you to edit any JavaScript file in the debugger source viewer. Enable the “Edit JavaScript” toggle and restart your browser. Once the feature is enabled, simply click on the Debugger's source viewer to place the cursor and start modifying your JavaScript!

Can you edit JavaScript in Firefox?

Firefox Developer Tools is a set of web developer tools built into Firefox. You can use them to examine, edit, and debug HTML, CSS, and JavaScript.


1 Answers

Chrome, Safari, and some other WebKit-based browsers contain a feature in the Web Inspector known as Live Edit. If you go to the Scripts panel and are stopped on a breakpoint (or maybe even if not stopped on a breakpoint — I'm not sure), you can double click on a line and start editing that line. The changes you make will take effect on the script.

like image 123
icktoofay Avatar answered Sep 18 '22 06:09

icktoofay