About this Book

Do more with less.

Plain and simple, that is the purpose of this book: to help you learn how to do more on your web application pages with less script. Your authors, one a jQuery contributor and evangelist and the other an avid and enthusiastic user, believe that jQuery is the best library available today to help you do just that.

This book is aimed at getting you up and running with jQuery quickly and effectively and, hopefully, having some fun along the way. The entire core jQuery API is discussed, and each API method is presented in an easy-to-digest syntax block that describes the parameters and return values of the method. Small examples of using the APIs effectively are included; and, for those big concepts, we provide what we call lab pages. These comprehensive and fun pages are an excellent way for you to see the nuances of the jQuery methods in action without the need to write a slew of code yourself.

All example code and lab pages are available for download at http://www.manning.com/bibeault.

We could go on and on with some marketing jargon telling you how great this book is, but you don’t want to waste time reading that, do you? What you really want is to get your arms into the bits and bytes up to your elbows, isn’t it?

What’s holding you back? Read on!

Audience

This book is aimed at novice to advanced web developers who want to take control of the JavaScript on their pages and produce great, interactive Rich Internet Applications without the need to write all the client-side code necessary to achieve such applications from scratch.

All web developers who yearn to create usable web applications that delight, rather than annoy, their users by leveraging the power that jQuery brings to them will benefit from this book.

Although novice web developers may find some sections a tad involved, this should not deter them from diving into this book. We’ve included an appendix on essential JavaScript concepts that help in using jQuery to its fullest potential, and such readers will find that the jQuery library itself is novice-friendly once they understand a few key concepts—all without sacrificing the power available to the more advanced web developers.

Whether novices or veterans of web development, client-side programmers will benefit greatly from adding jQuery to their repertoire of development tools. We know that the lessons within this book will help add this knowledge to your toolbox quickly.

Roadmap

This book is organized to help you wrap your head around jQuery in the quickest and most efficient manner possible. It starts with an introduction to the design philosophies on which jQuery was founded and quickly progresses to fundamental concepts that govern the jQuery API. We then take you through the various areas in which jQuery can help you write fabulous client-side code, from the handling of events all the way to making Ajax requests to the server. To top it all off, we take a survey of some of the most popular jQuery extensions.

In chapter 1, we’ll learn about the philosophy behind jQuery and how it adheres to modern principles such as Unobtrusive JavaScript. We examine why we might want to adopt jQuery and run through an overview of how it works, as well as the major concepts such as document-ready handlers, utility functions, Document Object Model (DOM) element creation, and how jQuery extensions are created.

Chapter 2 introduces us to the concept of the jQuery wrapped set—the core concept around which jQuery operates. We’ll learn how this wrapped set—a collection of DOM elements that’s to be operated upon—can be created by selecting elements from the page document using the rich and powerful collection of jQuery selectors. We’ll see how these selectors, while powerful, leverage knowledge that we already possess by using standard CSS notation.

In chapter 3, we’ll learn how to use the jQuery wrapped set to manipulate the page DOM. We cover changing the styling and attributes of elements, setting element content, moving elements around, and dealing with form elements.

Chapter 4 shows us how we can use jQuery to vastly simplify the handling of events on our pages. After all, handling user events is what makes Rich Internet Applications possible, and anyone who’s had to deal with the intricacies of event handler across the differing browser implementations will certainly appreciate the simplicity that jQuery brings to this particular area.

The world of animations and effects is the subject of chapter 5. We’ll see how jQuery makes creating animated effects not only painless but also efficient and fun.

In chapter 6, we’ll learn about the utility functions and flags that jQuery provides, not only for page authors, but also for those who will write extensions and plugins for jQuery.

We present writing such extensions and plugins in chapter 7. We’ll see how jQuery makes it extraordinarily easy for anyone to write such extensions without intricate JavaScript or jQuery knowledge and why it makes sense to write any reusable code as a jQuery extension.

Chapter 8 concerns itself with one of the most important areas in the development of Rich Internet Applications: making Ajax requests. We’ll see how jQuery makes it almost brain-dead simple to use Ajax on our pages and how it shields us from all the pitfalls that can accompany the introduction of Ajax to our pages, while vastly simplifying the most common types of Ajax interactions (such as returning JSON constructs).

Finally, in chapter 9 we’ll take a survey of the most popular and powerful of the vast multitude of jQuery plugins and make sure that we know where we can find information on even more such plugins. We examine plugins that enable us to deal with forms and Ajax submissions with even more power than core jQuery and those that let us employ drag-and-drop on our pages.

We provide an appendix highlighting key JavaScript concepts such as function contexts and closures—essential to making the most effective use of jQuery on our pages—for those who would like a refresher on these concepts.

Code conventions

All source code in listings or in the text is in a fixed-width font like this to separate it from ordinary text. Method and function names, properties, XML elements, and attributes in the text are also presented in this same font.

In some cases, the original source code has been reformatted to fit on the pages. In general, the original code was written with page-width limitations in mind, but sometimes you may find a slight formatting difference between the code in the listings and that provided in the source download. In a few rare cases, where long lines could not be reformatted without changing their meaning, the book listings will contain line-continuation markers.

Code annotations accompany many of the listings, highlighting important concepts. In many cases, numbered bullets link to explanations that follow in the text.

Code downloads

Source code for all the working examples in this book (along with some extras that never made it into the text) is available for download from http://www.manning.com/jQueryinAction or http://www.manning.com/bibeault.

The code examples for each chapter are organized to be easily served by a local web server. Unzip the downloaded code into a folder of your choice, and make that folder the document root of the application. A launch page is set up at the application root in the file index.html.

With the exception of the examples for chapter 8 and a handful from chapter 9, most of the examples don’t require the presence of a web server and can be loaded directly into a browser for execution. Instructions for easily setting up Tomcat to use as the web server for these examples is provided in file chapter8/tomcat.pdf.

All examples were tested in a variety of browsers that include Internet Explorer 7, Firefox 2, Opera 9, Safari 2, and Camino 1.5. The examples will also generally run in Internet Explorer 6 although some layout issues might be encountered. Note that all jQuery code works flawlessly in IE6—it’s the CSS of the examples that cause any layout anomalies. Because the target audience of this book is professional web developers, it’s assumed that all readers will have a variety of browsers available in which to execute the example code.

Author Online

The purchase of jQuery in Action includes free access to a private forum run by Manning Publications where you can make comments about the book, ask technical questions, and receive help from the authors and other users. To access and subscribe to the forum, point your browser to http://www.manning.com/jQueryinAction or http://www.manning.com/bibeault. This page provides information on how to get on the forum once you are registered, what kind of help is available, and the rules of conduct in the forum. (Play nice!)

Manning’s commitment to our readers is to provide a venue where a meaningful dialogue between individual readers and between readers and the authors can take place. It’s not a commitment to any specific amount of participation on the part of the authors, whose contribution to the book’s forum remains voluntary (and unpaid). We suggest you try asking the authors some challenging questions, lest their interest stray!

The Author Online forum and the archives of previous discussions will be accessible from the publisher’s website as long as the book is in print.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.31.156