Debugging dynamically added Javascript code
- by gilm
One of the programmers I worked with has something similar in code:
var head = document.getElementsByTagName("head")[0];
var e = document.createElement("script");
e.type = "text/javascript";
var b = "function moo() { alert('hello'); }";
e.appendChild(document.createTextNode(b));
head.appendChild(e);
moo();
This is all good and dandy, but I would like to step into moo(), and firebug just can't do that. I know I can rip the whole thing apart, but I reallllly don't want to touch it and his code works :)
Any ideas how I can debug this with Firebug?
Cheers