Javascript, jQuery and AJAX

Drupal includes built-in methods for implementing Javascript. Using these methods when you use Javascript will help to keep your code clean and to ensure compatibility with other modules' implementations.

A couple of simple principles guide Drupal's Javascript approach:

  • All pages should be perfectly functional without scripts. Javascript provides alternatives or supplements - not replacements - for standard elements.
  • No Javascript is hard-coded onto pages. Rather, actions are attached dynamically to page elements--and only if needed Javascript support is present.

See also the js developer API in the API section of the handbook.

 
 

Drupal is a registered trademark of Dries Buytaert.