The DOM has to be ready
$(document).ready(function() {
// Code Goes Here
});
The DOM has to be ready
$(document).ready(function() {
$(“#tabs”).tabs();
});
The Drupal Way
Drupal.behaviors.loadTabs = function(context) {
// Code Goes Here
};
The Drupal Way
Drupal.behaviors.loadTabs = function(context) {
$(“#tabs”).tabs();
};
Why use Drupal.behaviors?
• Ability to override JS
• Behaviors are re-attachable
• Attach Behaviors to a specific context
• HTML loaded via AHAH
Why use Drupal.behaviors?
• Ability to override JS
• Behaviors are re-attachable
• Attach Behaviors to a specific context
• HTML loaded via AHAH
Drupal.attachBehaviors(elem);
0 comments
Post a comment