diff options
Diffstat (limited to 'includes/common.inc')
-rw-r--r-- | includes/common.inc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/includes/common.inc b/includes/common.inc index 7b97fe67d..806ae97e0 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -2334,6 +2334,8 @@ function drupal_clear_css_cache() { * directly in the page. This can, for example, be useful to tell the user that * a new message arrived, by opening a pop up, alert box etc. This should only * be used for JavaScript which cannot be placed and executed from a file. + * When adding inline code, make sure that you are not relying on $ being jQuery. + * Wrap your code in (function($) { ... })(jQuery); or use jQuery instead of $. * * - Add settings ('setting'): * Adds a setting to Drupal's global storage of JavaScript settings. Per-page @@ -2344,8 +2346,8 @@ function drupal_clear_css_cache() { * @code * drupal_add_js('misc/collapse.js'); * drupal_add_js('misc/collapse.js', 'file'); - * drupal_add_js('$(document).ready(function(){alert("Hello!");});', 'inline'); - * drupal_add_js('$(document).ready(function(){alert("Hello!");});', + * drupal_add_js('jQuery(document).ready(function(){alert("Hello!");});', 'inline'); + * drupal_add_js('jQuery(document).ready(function(){alert("Hello!");});', * array('type' => 'inline', 'scope' => 'footer', 'weight' => 5) * ); * @endcode |