jQuery load() – dynamically loaded content scripts are accessible and can access parent scripts?

The answer is yes actually.


The scripts on the existing page can call the dynamically loaded scripts and the dynamically loaded scripts can call the existing static scripts.

Furthermore, if the dynamically loaded content contains the code:

$(document).ready( function(){ doSomething() });

The doSomething() call is in fact initiated once the dynamic content is loaded.

This seems consistent across all browsers, IE6/7/8, Firefox, Chrome and Opera.

Here’s an example:





Just for clarification purposes…….