Drupal jQuery Demo

This is a basic demo of Drupal and jQuery integration.
Please see "Drupal Theming + jQuery Basics (inc. Drupal Behaviors)" for the full tutorial of which this demo is a part.

Drupal 7 jQuery Demo

Click this link to toggle the content displayed below

This content will be toggled open and closed using jQuery.
Blah, blah, blah.
// Drupal 7.
(function ($) {
Drupal.behaviors.togg = {
 attach: function (context, settings) {
  $('a#togg-link', context).once('togg', function () {
   $(this).on('click', function (e) {
    $("div#togg").toggle(400);
    e.preventDefault();
   });
  });
 }
};
})(jQuery);
// Drupal 6.
Drupal.behaviors.togg = function (context) {
 $('a#togg-link:not(.togg-processed)', context).addClass('togg-processed').each(function () {
  $(this).click(function() {
   $("div#togg").toggle(400);
   return false;
  });
 });
};