Book Details

About This Book

An introduction to jQuery that requires minimal programming experience

Detailed solutions to specific client-side problems

Revised and updated version of this popular jQuery book

Who This Book Is For

This book is for web designers who want to create interactive elements for their designs, and for developers who want to create the best user interface for their web applications. Basic JavaScript programming and knowledge of HTML and CSS is required. No knowledge of jQuery is assumed, nor is experience with any other JavaScript libraries.

Table of Contents

Chapter 1: Getting Started

What jQuery does

Why jQuery works well

Our first jQuery-powered web page

Plain JavaScript vs. jQuery

Development tools

Summary

Chapter 2: Selecting Elements

The Document Object Model

The $() function

CSS selectors

Custom selectors

DOM traversal methods

Accessing DOM elements

Summary

Exercises

Chapter 3: Handling Events

Performing tasks on page load

Simple events

Compound events

The journey of an event

Altering the journey: the event object

Removing an event handler

Simulating user interaction

Summary

Exercises

Chapter 4: Styling and Animating

Inline CSS modification

Basic hide and show

Effects and speed

Creating custom animations

Simultaneous versus queued effects

Summary

Exercises

Chapter 5: Manipulating the DOM

Manipulating attributes

DOM tree manipulation

Copying elements

Content getter and setter methods

DOM manipulation methods in a nutshell

Summary

Exercises

Chapter 6: Sending Data with Ajax

Loading data on demand

Choosing a data format

Passing data to the server

Delivering different content for Ajax requests

Keeping an eye on the request

Error handling

Ajax and events

Security limitations

Additional options

Summary

Exercises

Chapter 7: Using Plugins

Finding plugins and help

How to use a plugin

The jQuery UI plugin library

Summary

Exercises

Chapter 8: Developing Plugins

Use of the $ alias in plugins

Adding new global functions

Adding jQuery object methods

Method parameters

The jQuery UI widget factory

Plugin design recommendations

Summary

Exercises

Chapter 9: Advanced Selectors and Traversing

Selecting and traversing revisited

Customizing and optimizing selectors

DOM traversal under the hood

Summary

Exercises

Chapter 10: Advanced Events

Events revisited

Event delegation

Custom events

Throttling events

Special events

Summary

Exercises

Chapter 11: Advanced Effects

Animation revisited

Observing and interrupting animations

Global effect properties

Multi-property easing

Deferred objects

Summary

Exercises

Chapter 12: Advanced DOM Manipulation

Sorting table rows

Moving and inserting elements, revisited

Storing data alongside DOM elements

Using HTML5 custom data attributes

Sorting and building rows with JSON

Advanced attribute manipulation

Summary

Exercises

Chapter 13: Advanced Ajax

Progressive enhancement with Ajax

Ajax error handling

The jqXHR object

Throttling Ajax requests

Extending Ajax capabilities

Summary

Exercises

What You Will Learn

Create interactive elements for your web designs

Learn how to create the best user interface for your web applications

Use selectors in a variety of ways to get anything you want from a page

Make things happen on your webpages with events

Add flair to your actions with a variety of animation effects

Discover the new features available in jQuery 1.6 in this third update of this popular jQuery book

In Detail

To build interesting, interactive sites, developers are turning to JavaScript libraries such as jQuery to automate common tasks and simplify complicated ones. Because many web developers have more experience with HTML and CSS than with JavaScript, the library's design lends itself to a quick start for designers with little programming experience. Experienced programmers will also be aided by its conceptual consistency.

Learning jQuery Third Edition is revised and updated for version 1.6 of jQuery. You will learn the basics of jQuery for adding interactions and animations to your pages. Even if previous attempts at writing JavaScript have left you baffled, this book will guide you past the pitfalls associated with AJAX, events, effects, and advanced JavaScript language features.

Starting with an introduction to jQuery, you will first be shown how to write a functioning jQuery program in just three lines of code. Learn how to add impact to your actions through a set of simple visual effects and to create, copy, reassemble, and embellish content using jQuery's DOM modification methods. The book will step you through many detailed, real-world examples, and even equip you to extend the jQuery library itself with your own plug-ins.

Authors

Jonathan Chaffer

Jonathan Chaffer is a member of Rapid Development Group, a web development firm located in Grand Rapids, Michigan. His work there includes overseeing and implementing projects in a wide variety of technologies, with an emphasis in PHP, MySQL, and JavaScript. He also leads on-site training seminars on the jQuery framework for web developers.
In the open source community, he has been very active in the Drupal CMS project, which has adopted jQuery as its JavaScript framework of choice. He is the creator of the Content Construction Kit, a popular module for managing structured content on Drupal sites. He is also responsible for major overhauls of Drupal's menu system and developer API reference.
He lives in Grand Rapids with his wife, Jennifer.

Karl Swedberg

Karl Swedberg is a web developer at Fusionary Media in Grand Rapids, Michigan, where he spends much of his time making cool things happen with JavaScript. As a member of the jQuery team, he is responsible for maintaining the jQuery API site at api.jquery.com. He is also a member of jQuery's Board of Advisors and a presenter at workshops and conferences. When he isn't coding, he likes to hang out with his family, roast coffee in his garage, and exercise at the local CrossFit gym.

Alerts & Offers

Series & Level

We understand your time is important. Uniquely amongst the major publishers, we seek to develop and publish the broadest range of learning and information products on each technology. Every Packt product delivers a specific learning pathway, broadly defined by the Series type. This structured approach enables you to select the pathway which best suits your knowledge level, learning style and task objectives.

Learning

As a new user, these step-by-step tutorial guides will give you all the practical skills necessary to become competent and efficient.

Beginner's Guide

Friendly, informal tutorials that provide a practical introduction using examples, activities, and challenges.

Essentials

Fast paced, concentrated introductions showing the quickest way to put the tool to work in the real world.

Cookbook

A collection of practical self-contained recipes that all users of the technology will find useful for building more powerful and reliable systems.

Blueprints

Guides you through the most common types of project you'll encounter, giving you end-to-end guidance on how to build your specific solution quickly and reliably.

Mastering

Take your skills to the next level with advanced tutorials that will give you confidence to master the tool's most powerful features.

Starting

Accessible to readers adopting the topic, these titles get you into the tool or technology so that you can become an effective user.

Progressing

Building on core skills you already have, these titles share solutions and expertise so you become a highly productive power user.