How to dynamically insert a tag via jQuery after page load?

You can put the script into a separate file, then use $.getScript to load and run it.

Example:

$.getScript("test.js", function(){
    alert("Running test.js");
});

Leave a Comment