What this book covers
Chapter 1, Getting Started, will get your feet wet with the jQuery JavaScript library. The chapter begins with a description of jQuery and what it can do for you. It then walks you through downloading and setting up the library, as well as writing your
first script.
Chapter 2, Selecting Elements, will teach how to use jQuery’s selector expressions and DOM traversal methods to find elements on the page, wherever they may be. You’ll use jQuery to apply styling to a diverse set of page elements, sometimes in a way
that pure CSS cannot.
Chapter 3, Handling Events, will walk you through jQuery’s event-handling mechanism to fire off behaviors when browser events occur. You’ll see how jQuery makes it easy to attach events to elements unobtrusively, even before the page finishes loading. Also, you’ll get an overview of deeper topics, such as event
bubbling, delegation, and namespacing.
Chapter 4, Styling and Animating, will introduce you to jQuery’s animation techniques and how to hide, show, and move page elements with effects that are both useful and pleasing to the eye.
Chapter 5, Manipulating the DOM, will teach you how to change your page on command. This chapter will also teach you how to alter the very structure of an HTML document, as well as adding to its content on the fly.
Chapter 6, Sending Data with Ajax, will walk you through many ways in which jQuery makes it easy to access server-side functionality without resorting to clunky page refreshes. With the basic components of the library well in hand, you will be ready to explore how the library can expand to fit your needs.
Chapter 7, Using Plugins, will show you how to find, install, and use plugins, including the powerful jQuery UI and jQuery Mobile plugin libraries.
Chapter 8, Developing Plugins, will teach you how to take advantage of jQuery’s impressive extension capabilities to develop your own plugins from the ground up. You’ll create your own utility functions, add jQuery object methods, and discover the jQuery UI widget factory. Next, you’ll take a second tour through jQuery’s building blocks, learning more advanced techniques.
Chapter 9, Advanced Selectors and Traversing, will refine your knowledge of selectors and traversals, gaining the ability to optimize selectors for performance, manipulate the DOM element stack, and write plugins that expand selecting and traversing capabilities.
Chapter 10, Advanced Events, will dive further into techniques such as delegation and throttling that can greatly improve event-handling performance. You’ll also create custom and special events that add even more capabilities to the jQuery library.
Chapter 11, Advanced Effects, will fine-tune the visual effects of jQuery that can be provided by crafting custom-easing functions and reacting to each step of an animation. You’ll gain the ability to manipulate animations as they occur and schedule actions with custom queuing.
Chapter 12, Advanced DOM Manipulation, will provide you with more practice modifying the DOM with techniques such as attaching arbitrary data to elements. You’ll also learn how to extend the way jQuery processes CSS properties on elements.
Chapter 13, Advanced Ajax, will help you achieve a greater understanding of Ajax transactions, including the jQuery deferred object system for handling data that may become available at a later time.
Appendix A, JavaScript Closures, will help you gain a solid understanding of closures in JavaScript—what they are and how you can use them to your advantage.
Appendix B, Testing JavaScript with QUnit, will teach you about the QUnit library for unit testing of JavaScript programs. This library will add to your toolkit for developing and maintaining highly sophisticated web applications.
Appendix C, Quick Reference, will provide a glimpse of the entire jQuery library, including every one of its methods and selector expressions. Its easy-to-scan format is perfect for those moments when you know what you want to do, but you’re just unsure about the right method name or selector.
What you need for this book
In order to run the example code demonstrated in this book, you need a modern web browser such as Google Chrome, Mozilla Firefox, Apple Safari, or Microsoft Internet Explorer.
To experiment with the examples and to work on the chapter-ending exercises, you will also need:
- A basic text editor
- Web development tools for the browser such as the Chrome Developer Tools or Firebug (as described in the Using development tools section of Chapter 1, Getting Started )
- The full code package for each chapter, which includes a copy of the jQuery library (seen in the following Downloading the example code section)
Additionally, to run some of the Ajax examples in Chapter 6, Sending Data with Ajax and beyond, you will need a PHP-enabled web server.
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 knowledge is required. You will need to know the basics of HTML and CSS and should be comfortable with the syntax of JavaScript. Prior knowledge of jQuery is not assumed, nor is experiencing with any other JavaScript libraries required.
By reading this book, you will become familiar with the functionality and syntax of jQuery 1.10.x and jQuery 2.0.x, the latest versions at the time of writing.