Behind the Curtain: Writing jQuery the Drupal Way

jQuery isn't the talk of the town anymore, but it remains an important piece of many Drupal projects. Unfortunately it is also one of the least understood. Too many of us copy example files, empty the middle, hack away until something works, slap it on the page, and run away screaming. It doesn’t have to be like that.

This session is for anyone without a solid understanding of how to write custom jQuery for a Drupal 7 project. Learning what Drupal behaviors are, how Drupal uses them, and how to write them goes a long way. You'll realize your jQuery isn't working how you thought it was and it isn't hard to fix. Furthermore, following best practices will improve the efficiency and maintainability of your project.

This session will cover:

  • the anatomy of a jQuery file in Drupal
  • what behaviors are and how Drupal uses them
  • the best practices for writing custom behaviors
  • the Drupal JavaScript object and what it can do
  • organizing jQuery files and adding them to a page

Session Track

Front End

Experience level

Intermediate

Drupal Version

Drupal 7