views:

256

answers:

3

Is there any jquery plugin (instead of incldeMany) or simple function to include js-files on demand ?

for example:

$.include('myscript.js'); 

?

A: 

http://labjs.com/

Kind Regards

--Andy

jAndy
A: 

Not exactly a jQuery plugin, but you might try looking into RequireJS. Especially the "How to use RequireJS with jQuery" section.

I don't have much experience with this solution yet, but from what I've read and played around with I like the possibilities.

Aaron Wagner
+3  A: 

How about jQuery.getScript()? It's built in to jQuery and works like so:

$.getScript('ajax/test.js', function() {
    alert('Load was performed.');
});
Olly Hodgson