![]() ![]() While this is nice, it would be much more efficient if you called refreshButton's onclick method itself. ![]() I see what you are trying to do by not having the HTML code memorize anything everything is handled in references which all boils down to a few elements. Sure, this isn't terribly inefficient, but it can be made simpler. Why? Well, think about what your code has to do: This code is very clean, and I believe that it is a very useful tool for any JavaScript developer. Create new script element and load a script into it Var js = document.getElementById("sandboxScript") Ĭ("- Script refreshed -") Check for existing script element and delete it if it exists The most current version of this code is available here. As the title within the code below suggests, it's a sandbox intended for rapid testing of JavaScript code, where I can just save code in the IDE and execute the updated code immediately. The sandbox.js file is assumed to contain a function sandbox() which may contain arbitrary JavaScript code. The following code is designed to load and refresh JavaScript code from an external file sandbox.js and allow it to be refreshed dynamically and executed without reloading the entire page.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |