开发者

Load javascript via Firebug console

开发者 https://www.devze.com 2023-01-03 10:56 出处:网络
开发者_Python百科How can I load a javascript file via Firebug console ? This would be useful in development, so I don\'t have to modify the html code to load the script.var script = document.createEl

开发者_Python百科How can I load a javascript file via Firebug console ?

This would be useful in development, so I don't have to modify the html code to load the script.


var script = document.createElement("script");
script.src = "http://whatever.com/js/my/script.js";
document.body.appendChild(script);


A very handy command is include();

include("http://code.jquery.com/jquery-latest.min.js");

Read more about include() command


Just ran into the same problem, and - as jQuery is used in the project anyway - I decided to do a simple:

$.getScript('example.js')

Or:

$.getScript('example.js', function () { doSomethingOnceLoaded(); })

Alternatively, I may code JavaScript directly in Firebug, using the console with the text entry pane on the right side. Activate it with the triangle button in the lower right hand corner.

0

精彩评论

暂无评论...
验证码 换一张
取 消