In Drupal 7 it's required to wrap my jquery codes in

(function ($) {
// Original JavaScript code.
})(jQuery);

But it makes all the variables local and I cant access them from another file. How can pass the variables around as if they are global?

Comments

nod_’s picture

Status: Active » Fixed

You can add things in the Drupal object but that's pretty dirty.

The typical way of doing that is using events to pass things around.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.