jQuery examples
As of Drupal version 5.0, most of what can be achieved with Javascript will be made possible by the jQuery Javascript library. To quote from the jQuery website:
jQuery is a new type of Javascript library. It is not a huge, bloated framework promising the best in AJAX - nor is it just a set of needlessly complex enhancements - jQuery is designed to change the way that you write Javascript.
Note: Most information about jQuery can and should be obtained from the jQuery website, this section of the handbook will avoid duplicating information better maintained there.
Resources on the web:
- jQuery: the official jQuery web site. See in particular:
- visual jquery: a graphically organized jquery reference
- Learning jQuery: a multi-author weblog with the aim of sharing information about jQuery
- Other more Drupal specific resources:
- Dojo Lesson #12 - jQuery Resurrected: their mission? To show how easy it is to take your Drupal site to the cutting edge of User Interface with jQuery, talk about the tools and resources that make this easy, and outline some best-practices for security. See also the drupal group discussion.
Developing sites that use Javascript has been made even easier with the inclusion of jQuery into core as of Drupal 5.0. jQuery syntax is easy and powerful, and a robust library of plug-ins means a lot of the effects you could ever dream to include in your modules and sites are already supported.
Manipulating the Document Object Model (DOM) with jQuery is as simple as knowing a little bit of CSS and a little bit of Javascript. Using a selector function that works using CSS selectors, you tell jQuery you plan to act on a certain set of elements from the DOM. You then chain jQuery methods to the selector to manipulate or query the data in any way imaginable.
The child pages in this section should be related to understanding jQuery syntax in relation to Drupal class and ID naming conventions, providing example code for various jQuery methods, and offering code tips that answer the question, "But how do I do this with jQuery?"
More information on jQuery in Drupal may be found here: http://drupal.org/node/88978
