Drupal jQuery behaviors
Submitted by Jitesh Doshi
on Sun, 05/12/2013 - 14:49
In this article, I try to explain "Drupal Behaviors". Drupal provides a very clean way of attaching JavaScript code to HTML components. It includes jQuery library with it. So you have to do nothing to add jQuery to your app. But on top of it, you also don't have to attach onload event handlers in JavaScript. Instead you simply write "Drupal JS behaviors" which are JavaScript functions that get invoked when attached (document loaded) or detached (document unloaded).
Let's take a look at an example:
- Read more about Drupal jQuery behaviors
- Log in to post comments