Posterous theme by Cory Watilo

Using JQuery in Drupal 7

Looks like adding custom JQuery scripts in Drupal 7 just got harder.

The $ is no longer specific to JQuery as it allows flexibility to other javascript libraries.

Therefore, to get a JQuery script to be recognized in Drupal 7, you need to wrap the code in an anonymous function... like this...

(function($) {
   $().ready(function() {
         //...
    });
})(jQuery);

| Viewed
times
Filed under: