jQuery in Action, Third Edition
Bear Bibeault, Yehuda Katz, and Aurelio De Rosa
Forewords by Dave Methvin and John Resig
  • August 2015
  • ISBN 9781617292071
  • 504 pages
  • printed in black & white
free previous edition eBook included
An eBook copy of the previous edition of this book is included at no additional cost. It will be automatically added to your Manning Bookshelf within 24 hours of purchase.

Does a great job of showing how all the parts of jQuery fit together and demonstrates important concepts.

From the Foreword by Dave Methvin, President jQuery Foundation

jQuery in Action, Third Edition, is a fast-paced and complete guide to jQuery, focused on the tasks you'll face in nearly any web dev project. Written for readers with minimal JavaScript experience, this revised edition adds new examples and exercises, along with the deep and practical coverage you expect from an In Action book. You'll learn how to traverse HTML documents, handle events, perform animations, write plugins, and even unit test your code. The unique lab pages anchor each concept with real-world code. Several new chapters teach you how to interact with other tools and frameworks to build modern single-page web applications.

About the book

Thanks to jQuery, no one remembers the bad old days when programmers manually managed browser inconsistencies, CSS selectors support, and DOM navigation, and when every animation was a frustrating exercise in raw JavaScript. The elegant, intuitive jQuery library beautifully manages these concerns, and jQuery 3 adds even more features to make your life as a web developer smooth and productive.

jQuery in Action, Third Edition, is a fast-paced guide to jQuery, focused on the tasks you'll face in nearly any web dev project. In it, you'll learn how to traverse the DOM, handle events, perform animations, write jQuery plugins, perform Ajax requests, and even unit test your code. Its unique Lab Pages anchor each concept in real-world code. This expanded Third Edition adds new chapters that teach you how to interact with other tools and frameworks and build modern single-page web applications.

Table of Contents detailed table of contents

foreword to the third edition

foreword to the first edition



about this book

about the authors

author online

about the cover illustration

Part 1: Starting with jQuery

1. Introducing jQuery

1.1. Write less, do more

1.2. Unobtrusive JavaScript

1.2.1. Separating behavior from structure

1.2.2. Segregating the script

1.3. Installing jQuery

1.3.1. Choosing the right version

1.3.2. Improving performances using a CDN

1.4. How jQuery is structured

1.4.1. Save space creating your own custom build

1.5. jQuery fundamentals

1.5.1. Properties, utilities, and methods

1.5.2. The jQuery object

1.5.3. The document ready handler

1.6. Summary

Part 2: Core jQuery

2. Selecting elements

2.1. Selecting elements for manipulation

2.2. Basic selectors

2.2.1. The All (or Universal) selector

2.2.2. The ID selector

2.2.3. The Class selector

2.2.4. The Element selector

2.3. Retrieving elements by their hierarchy

2.4. Selecting elements using attributes

2.5. Introducing filters

2.5.1. Position filters

2.5.2. Child filters

2.5.3. Form filters

2.5.4. Content filters

2.5.5. Other filters

2.5.6. How to create custom filters

2.6. Enhancing performances using context

2.7. Testing your skills with some exercises

2.7.1. Exercises

2.7.2. Solutions

2.8. Summary

3. Operating on a jQuery collection

3.1. Generating new HTML

3.2. Managing the jQuery collection

3.2.1. Determining the size of a set

3.2.2. Obtaining elements from a set

3.2.3. Getting sets using relationships

3.2.4. Slicing and dicing a set

3.2.5. Even more ways to use a set

3.3. Summary

4. Working with properties, attributes, and data

4.1. Defining element properties and attributes

4.2. Working with attributes

4.2.1. Fetching attribute values

4.2.2. Setting attribute values

4.2.3. Removing attributes

4.2.4. Fun with attributes

4.3. Manipulating element properties

4.4. Storing custom data on elements

4.5. Summary

5. Bringing pages to life with jQuery

5.1. Changing element styling

5.1.1. Adding and removing class names

5.1.2. Getting and setting styles

5.2. Setting element content

5.2.1. Replacing HTML or text content

5.2.2. Moving elements

5.2.3. Wrapping and unwrapping elements

5.2.4. Removing elements

5.2.5. Cloning elements

5.2.6. Replacing elements

5.3. Dealing with form element values

5.4. Summary

6. Events are where it happens!

6.1. Understanding the browser event models

6.1.1. The DOM Level 0 Event Model

6.1.2. The DOM Level 2 Event Model

6.1.3. The Internet Explorer Model

6.2. The jQuery Event Model

6.2.1. Attaching event handlers with jQuery

6.2.2. Removing event handlers

6.2.3. Inspecting the Event instance

6.2.4. Triggering event handlers

6.2.5. Shortcut methods

6.2.6. How to create custom events

6.2.7. Namespacing events

6.3. Summary

7. Demo: DVD discs locator

7.1. Putting events (and more) to work

7.1.1. Filtering large data sets

7.1.2. Element creation by template replication

7.1.3. Setting up the mainline markup

7.1.4. Adding new filters

7.1.5. Adding the controls templates

7.1.6. Removing unwanted filters and other tasks

7.1.7. Showing the results

7.1.8. There’s always room for improvement

7.2. Summary

8. Energizing pages with animations and effects

8.1. Showing and hiding elements

8.1.1. Implementing a collapsible "module"

8.1.2. Toggling the display state of elements

8.2. Animating the display state of elements

8.2.1. Showing and hiding elements gradually

8.2.2. Introducing the jQuery Effects Lab Page

8.2.3. Fading elements into and out of existence

8.2.4. Sliding elements up and down

8.2.5. Stopping animations

8.3. Adding more easing functions to jQuery

8.4. Creating custom animations

8.4.1. A custom scale animation

8.4.2. A custom drop animation

8.4.3. A custom puff animation

8.5. Animations and queuing

8.5.1. Simultaneous animations

8.5.2. Queuing functions for execution

8.5.3. Inserting functions into the effects queue

8.6. Summary

9. Beyond the DOM with jQuery utility functions

9.1. Using the jQuery properties

9.1.1. Disabling animations

9.1.2. Changing the animations rate

9.1.3. The $.support property

9.2. Using other libraries with jQuery

9.3. Manipulating JavaScript objects and collections

9.3.1. Trimming strings

9.3.2. Iterating through properties and collections

9.3.3. Filtering arrays

9.3.4. Translating arrays

9.3.5. More fun with JavaScript arrays

9.3.6. Extending objects

9.3.7. Serializing parameter values

9.3.8. Testing objects

9.3.9. Parsing functions

9.4. Miscellaneous utility functions

9.4.1. Doing nothing

9.4.2. Testing for containment

9.4.3. Prebinding function contexts

9.4.4. Evaluating expressions

9.4.5. Throwing exceptions

9.5. Summary

10. Talk to the server with Ajax

10.1. Brushing up on Ajax

10.1.1. Creating an XHR instance

10.1.2. Initiating the request

10.1.3. Keeping track of progress

10.1.4. Getting the response

10.2. Loading content into elements

10.2.1. Loading content with jQuery

10.2.2. Loading dynamic HTML fragments

10.3. Making GET and POST requests

10.3.1. Getting data with GET

10.3.2. Getting JSON data

10.3.3. Dynamically loading script

10.3.4. Making POST requests

10.3.5. Implementing cascading dropdowns

10.4. Taking full control of an Ajax request

10.4.1. Making Ajax requests with all the trimmings

10.4.2. Setting request defaults

10.4.3. Handling Ajax events

10.4.4. Advanced Ajax utility functions

10.5. Summary

11. Demo: an Ajax-powered contact form

11.1. The features of the project

11.2. Creating the markup

11.3. Implementing the PHP backend

11.4. Field validation using Ajax

11.5. Even more fun with Ajax

11.5.1. Hiding the dialog box

11.6. Improving the user experience using effects

11.6.1. Toggling the effects

11.7. A note on accessibility

11.8. Summary

Part 3: Advanced topics

12. When jQuery is not enough…​plugins to the rescue!

12.1. Why extend jQuery?

12.2. Where to find plugins

12.2.1. How to use a (well-written) plugin

12.2.2. Great plugins for your projects

12.3. The jQuery plugin authoring guidelines

12.3.1. File- and function-naming conventions

12.3.2. Beware the $

12.3.3. Taming complex parameter lists

12.3.4. Keep one namespace

12.3.5. Namespacing events and data

12.3.6. Maintaining chainability

12.3.7. Provide public access to default settings

12.4. Demo: creating a slideshow as a jQuery plugin

12.4.1. Setting up the markup

12.4.2. Developing Jqia Photomatic

12.5. Writing custom utility functions

12.5.1. Writing a date formatter

12.6. Summary

13. Avoiding the callback hell with Deferred

13.1. Introduction to promises

13.2. The Deferred and Promise objects

13.3. The Deferred methods

13.3.1. Resolving or rejecting a Deferred

13.3.2. Execute functions upon resolution or rejection

13.3.3. The when() method

13.3.4. Notifying about the progress of a Deferred

13.3.5. Follow the progress

13.3.6. Using the Promise object

13.3.7. Take it short with then()

13.3.8. Always execute a handler

13.3.9. Determine the state of a Deferred

13.4. Promisifying all the things

13.5. Summary

14. Unit testing with QUnit

14.1. Why testing is important?

14.1.1. Why unit testing?

14.1.2. Frameworks for unit testing JavaScript

14.2. Getting started with QUnit

14.3. Creating tests for synchronous code

14.4. Testing your code using assertions

14.4.1. equal(), strictEqual(), notEqual(), and notStrictEqual()

14.4.2. The other assertion methods

14.4.3. The throws() assertion method

14.5. How to test asynchronous tasks

14.6. noglobals and notrycatch

14.7. Group your tests in modules

14.8. Configuring QUnit

14.9. An example of test suite

14.10. Summary

15. How jQuery fits into large projects

15.1. Improving the performance of your selectors

15.1.1. Avoiding the Universal selector

15.1.2. Improving the Class selector

15.1.3. Don’t abuse the context parameter

15.1.4. Optimizing filters

15.1.5. Don’t overspecify selectors

15.2. Organizing your code into modules

15.2.1. The object literals pattern

15.2.2. The Module pattern

15.3. Loading modules with RequireJS

15.3.1. Getting started with RequireJS

15.3.2. Using RequireJS with jQuery

15.4. Managing dependencies with Bower

15.4.1. Getting started with Bower

15.4.2. Searching a package

15.4.3. Installing, updating, and deleting packages

15.5. Creating single-page applications with Backbone.js

15.5.1. Why use an MV* framework?

15.5.2. Starting with Backbone.js

15.5.3. Creating a Todos manager application using Backbone.js

15.6. Summary

15.7. The end


Appendix A: JavaScript that you need to know but might not!

A.1. JavaScript Object fundamentals

A.1.1. How objects come to be

A.1.2. Properties of objects

A.1.3. Object literals

A.1.4. Objects as window properties

A.2. Functions as first-class citizens

A.2.1. Function expressions and function declarations

A.2.2. Functions as callbacks

A.2.3. What’s this all about?

A.2.4. Closures

A.2.5. Immediately-Invoked Function Expression

A.3. Summary

What's inside

  • Updated for jQuery 3
  • DOM manipulation and event handling
  • Animations and effects
  • Advanced topics including Unit Testing and Promises
  • Practical examples and labs

About the reader

Readers are assumed to have only beginning-level JavaScript knowledge.

About the authors

Bear Bibeault is coauthor of Secrets of the JavaScript Ninja, Ajax in Practice and Prototype and Scriptaculous in Action. Yehuda Katz is an early contributor to jQuery and co-creator of Ember.js. Aurelio De Rosa is a full-stack web developer who contributes to various open source projects and a member of the jQuery content team.

placing your order...

Don't refresh or navigate away from the page.
print book $24.99 $44.99 pBook + eBook + liveBook
includes previous edition eBook
Additional shipping charges may apply
Prints and ships within 3-5 days
jQuery in Action, Third Edition (print book) added to cart
continue shopping
go to cart

eBook $35.99 3 formats + liveBook
includes previous edition eBook
jQuery in Action, Third Edition (eBook) added to cart
continue shopping
go to cart

Prices displayed in rupees will be charged in USD when you check out.
customers also reading

This book

FREE domestic shipping on three or more pBooks