Theming

Drupal.behaviors and Drupal-Specific JavaScript for Drupal 6, 7

Last updated
Categories

This page is archived

We're keeping this page up as a courtesy to folks who may need to refer to old instructions. We don't plan to update this page.

Alternate resources

Sprout Video

Goes into depth about some of the JavaScript constructs and tools that Drupal provides when writing JavaScript for Drupal. Topics include using Drupal.behaviors and variable settings.

There where a couple of changes to the Drupal.behaviors system for D7. You can find out more information about the changes here: http://drupal.org/update/modules/6/7#drupal_behaviors

And more general information about using the new system here http://drupal.org/node/756722

Once you've converted from the old Drupal.behaviors.myModule = function(context) to the new syntax

Drupal.behaviors.myModule = {
attach: function(context, settings),
detach: function(context, settings)
}

The rest is pretty much the same.

Legacy Module Development