06.05.2013 Views

Drupal 6 JavaScript and jQuery - Ebook-Cours.com

Drupal 6 JavaScript and jQuery - Ebook-Cours.com

Drupal 6 JavaScript and jQuery - Ebook-Cours.com

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

The <strong>jQuery</strong> site is a great source for API documentation, tutorials,<br />

plug-ins, <strong>and</strong> additional tools: http://jquery.<strong>com</strong>.<br />

[ 61 ]<br />

Chapter 3<br />

With a library like this, less time must be spent on writing boilerplate code or trying<br />

to address cross-browser <strong>com</strong>patibility issues. Instead, more time can be spent on<br />

creating a powerful <strong>and</strong> robust <strong>JavaScript</strong> code.<br />

<strong>jQuery</strong> is an open source software, dual-licensed under either the GPL<br />

(the GNU General Public License) or the MIT license. Just as the <strong>Drupal</strong><br />

developers included <strong>jQuery</strong> in <strong>Drupal</strong> 6, so can you use <strong>jQuery</strong> on your<br />

own sites <strong>and</strong> web applications.<br />

<strong>jQuery</strong> provides a single, <strong>com</strong>pact library focused on simplifying the following tasks:<br />

•<br />

•<br />

•<br />

•<br />

•<br />

Finding things in a document<br />

Manipulating a document through the DOM<br />

Interacting with a document's CSS<br />

Working with events<br />

Providing flexible AJAX tools<br />

Moreover, the library works on all major browsers—Internet Explorer, Firefox,<br />

Opera, <strong>and</strong> Safari.<br />

As if this weren't enough, there's one more feature of <strong>jQuery</strong> that makes it a<br />

<strong>com</strong>pelling tool for developers: It uses a tremendously <strong>com</strong>pact syntax that makes<br />

it easy to ac<strong>com</strong>plish surprisingly <strong>com</strong>plex tasks in just a line or two of code. With a<br />

simple plug-in architecture (with hundreds of plug-ins already available), it can be<br />

extended to provide additional functionality.<br />

One popular addition to <strong>jQuery</strong> is <strong>jQuery</strong> UI. This library provides<br />

<strong>com</strong>plex widgets such as calendars, accordions, <strong>and</strong> tabs. It also provides<br />

support for drag-<strong>and</strong>-drop, sorting, <strong>and</strong> other similar tasks. You can learn<br />

more about it at http://ui.jquery.<strong>com</strong>.<br />

Okay, so what's the catch?<br />

There is one aspect of <strong>jQuery</strong> that gets criticized on occasion. <strong>jQuery</strong> code looks<br />

different from other <strong>JavaScript</strong>, <strong>and</strong> this can make that initial jump into <strong>jQuery</strong> seem<br />

daunting. But once you've made that leap, it will change the way you write <strong>JavaScript</strong>.<br />

Hopefully, this chapter will help make that first step an easy one. Let's take that first<br />

step now.<br />

This material is copyright <strong>and</strong> is licensed for the sole use by Richard Ostheimer on 18th June 2009<br />

2205 hilda ave., , missoula, , 59801

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!