Dynamically inserted scripts are only executed when appended to the <head>, I bet it works like this (maybe not):
$(document).ready(function(){ vSrc = "external.js"; $("#target").attr("src", vSrc).appendTo('head'); }); On Nov 18, 6:25 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I have an issue that I initially thought was a jQuery problem, but > after simplifying things in preparation for posting my question, I see > that it's a fundamental javascript matter. > I don't understand why this works:http://pastebin.com/m3a767745 > but this doesn't:http://pastebin.com/m346451b4 > Note that the "external.js" file is just a single alert statement. > > What I'm trying to do (with javascript) is create a <script> element, > place it inside a particular element and execute it. > Thanks, > -Rob