Reputation: 9090
I am planning on separating independent .js
files and I wonder if I can use them together after that.
The problem might be that all of them have something similar to
$(function() { code here };
Is it safe to make jQuery to run multiple times, from different locations, this method?
Upvotes: 0
Views: 82
Reputation: 3443
If you are using many .js files you might want to use require.js (http://requirejs.org/). This framework will optimize the loading of multiple scripts.
Upvotes: 1
Reputation: 32598
Yes. .ready(callback)
is shorthand for .bind("ready", callback);
. Event bind calls in jQuery let you add multiple handlers for a single event.
Upvotes: 0
Reputation: 50976
YES
I see no reason why wouldn't you be able to "run" jQuery multiple times.. It's function and function is about to be albe to be called multiple times
Upvotes: 0