Hey,

I do something similar, I move all my includes to my page JS file.  I
also have a common JS file that all pages include (each page includes
the jQuery.js file, my global.js file, and the page's js file in the
<head>).

In my global.js, I have the following function:
function includeJs(file) {
        // Handle multiple include attempts
        if($("script[src='" + file + "']").size() == 0) {
                $('head').createAppend(
                        'script', {
                                type: 'text/javascript',
                                src: file
                        }
                );
        }
}

Then, at the top of each page JS, I have:

includeJs("resources/javascript/jquery/jquery.bgiframe.js");
includeJs("resources/javascript/jquery/jquery.dimensions.js");

The URL to the JS should be relative from the page being viewed.

- Jamie Goodfellow





On Feb 15, 12:12 pm, Nazgulled <[EMAIL PROTECTED]> wrote:
> Hi,
> I make good use of various jQuery plugins that are available, however,
> I don't like the idea of having the <head> tag of the page filled with
> <script> tags for all the plugins I use.
>
> Is there way to load jQuery plugins dynamically at run time?
> Basically, I just want to add 2 <script> tags to the document <head>,
> one for jQuery itself and another for all my JS coding for that page.
>
> How can I load jQuery plugins dynamically?

Reply via email to