Books & Videos

Table of Contents

  1. Chapter 1 jQuery Basics

    1. Introduction

    2. Including the jQuery Library Code in an HTML Page

    3. Executing jQuery/JavaScript Coded After the DOM Has Loaded but Before Complete Page Load

    4. Selecting DOM Elements Using Selectors and the jQuery Function

    5. Selecting DOM Elements Within a Specified Context

    6. Filtering a Wrapper Set of DOM Elements

    7. Finding Descendant Elements Within the Currently Selected Wrapper Set

    8. Returning to the Prior Selection Before a Destructive Change

    9. Including the Previous Selection with the Current Selection

    10. Traversing the DOM Based on Your Current Context to Acquire a New Set of DOM Elements

    11. Creating, Operating on, and Inserting DOM Elements

    12. Removing DOM Elements

    13. Replacing DOM Elements

    14. Cloning DOM Elements

    15. Getting, Setting, and Removing DOM Element Attributes

    16. Getting and Setting HTML Content

    17. Getting and Setting Text Content

    18. Using the $ Alias Without Creating Global Conflicts

  2. Chapter 2 Selecting Elements with jQuery

    1. Introduction

    2. Selecting Child Elements Only

    3. Selecting Specific Siblings

    4. Selecting Elements by Index Order

    5. Selecting Elements That Are Currently Animating

    6. Selecting Elements Based on What They Contain

    7. Selecting Elements by What They Don’t Match

    8. Selecting Elements Based on Their Visibility

    9. Selecting Elements Based on Attributes

    10. Selecting Form Elements by Type

    11. Selecting an Element with Specific Characteristics

    12. Using the Context Parameter

    13. Creating a Custom Filter Selector

  3. Chapter 3 Beyond the Basics

    1. Introduction

    2. Looping Through a Set of Selected Results

    3. Reducing the Selection Set to a Specified Item

    4. Convert a Selected jQuery Object into a Raw DOM Object

    5. Getting the Index of an Item in a Selection

    6. Making a Unique Array of Values from an Existing Array

    7. Performing an Action on a Subset of the Selected Set

    8. Configuring jQuery Not to Conflict with Other Libraries

    9. Adding Functionality with Plugins

    10. Determining the Exact Query That Was Used

  4. Chapter 4 jQuery Utilities

    1. Introduction

    2. Detecting Features with

    3. Iterating Over Arrays and Objects with jQuery.each

    4. Filtering Arrays with jQuery.grep

    5. Iterating and Modifying Array Entries with

    6. Combining Two Arrays with jQuery.merge

    7. Filtering Out Duplicate Array Entries with jQuery.unique

    8. Testing Callback Functions with jQuery.isFunction

    9. Removing Whitespace from Strings or Form Values with jQuery.trim

    10. Attaching Objects and Data to DOM with

    11. Extending Objects with jQuery.extend

  5. Chapter 5 Faster, Simpler, More Fun

    1. Introduction

    2. That’s Not jQuery, It’s JavaScript!

    3. What’s Wrong with $(this)?

    4. Removing Redundant Repetition

    5. Formatting Your jQuery Chains

    6. Borrowing Code from Other Libraries

    7. Writing a Custom Iterator

    8. Toggling an Attribute

    9. Finding the Bottlenecks

    10. Caching Your jQuery Objects

    11. Writing Faster Selectors

    12. Loading Tables Faster

    13. Coding Bare-Metal Loops

    14. Reducing Name Lookups

    15. Updating the DOM Faster with .innerHTML

    16. Debugging? Break Those Chains

    17. Is It a jQuery Bug?

    18. Tracing into jQuery

    19. Making Fewer Server Requests

    20. Writing Unobtrusive JavaScript

    21. Using jQuery for Progressive Enhancement

    22. Making Your Pages Accessible

  6. Chapter 6 Dimensions

    1. Introduction

    2. Finding the Dimensions of the Window and Document

    3. Finding the Dimensions of an Element

    4. Finding the Offset of an Element

    5. Scrolling an Element into View

    6. Determining Whether an Element Is Within the Viewport

    7. Centering an Element Within the Viewport

    8. Absolutely Positioning an Element at Its Current Position

    9. Positioning an Element Relative to Another Element

    10. Switching Stylesheets Based on Browser Width

  7. Chapter 7 Effects

    1. Introduction

    2. Sliding and Fading Elements in and out of View

    3. Making Elements Visible by Sliding Them Up

    4. Creating a Horizontal Accordion

    5. Simultaneously Sliding and Fading Elements

    6. Applying Sequential Effects

    7. Determining Whether Elements Are Currently Being Animated

    8. Stopping and Resetting Animations

    9. Using Custom Easing Methods for Effects

    10. Disabling All Effects

    11. Using jQuery UI for Advanced Effects

  8. Chapter 8 Events

    1. Introduction

    2. Attaching a Handler to Many Events

    3. Reusing a Handler Function with Different Data

    4. Removing a Whole Set of Event Handlers

    5. Triggering Specific Event Handlers

    6. Passing Dynamic Data to Event Handlers

    7. Accessing an Element ASAP (Before document.ready)

    8. Stopping the Handler Execution Loop

    9. Getting the Correct Element When Using

    10. Avoid Multiple hover() Animations in Parallel

    11. Making Event Handlers Work for Newly Added Elements

  9. Chapter 9 Advanced Events

    1. Introduction

    2. Getting jQuery to Work When Loaded Dynamically

    3. Speeding Up Global Event Triggering

    4. Creating Your Own Events

    5. Letting Event Handlers Provide Needed Data

    6. Creating Event-Driven Plugins

    7. Getting Notified When jQuery Methods Are Called

    8. Using Objects’ Methods as Event Listeners

  10. Chapter 10 HTML Form Enhancements from Scratch

    1. Introduction

    2. Focusing a Text Input on Page Load

    3. Disabling and Enabling Form Elements

    4. Selecting Radio Buttons Automatically

    5. (De)selecting All Checkboxes Using Dedicated Links

    6. (De)selecting All Checkboxes Using a Single Toggle

    7. Adding and Removing Select Options

    8. Autotabbing Based on Character Count

    9. Displaying Remaining Character Count

    10. Constraining Text Input to Specific Characters

    11. Submitting a Form Using Ajax

    12. Validating Forms

  11. Chapter 11 HTML Form Enhancements with Plugins

    1. Introduction

    2. Validating Forms

    3. Creating Masked Input Fields

    4. Autocompleting Text Fields

    5. Selecting a Range of Values

    6. Entering a Range-Constrained Value

    7. Uploading Files in the Background

    8. Limiting the Length of Text Inputs

    9. Displaying Labels Above Input Fields

    10. Growing an Input with Its Content

    11. Choosing a Date

  12. Chapter 12 jQuery Plugins

    1. Introduction

    2. Where Do You Find jQuery Plugins?

    3. When Should You Write a jQuery Plugin?

    4. Writing Your First jQuery Plugin

    5. Passing Options into Your Plugin

    6. Using the $ Shortcut in Your Plugin

    7. Including Private Functions in Your Plugin

    8. Supporting the Metadata Plugin

    9. Adding a Static Function to Your Plugin

    10. Unit Testing Your Plugin with QUnit

  13. Chapter 13 Interface Components from Scratch

    1. Introduction

    2. Creating Custom Tool Tips

    3. Navigating with a File-Tree Expander

    4. Expanding an Accordion

    5. Tabbing Through a Document

    6. Displaying a Simple Modal Window

    7. Building Drop-Down Menus

    8. Cross-Fading Rotating Images

    9. Sliding Panels

  14. Chapter 14 User Interfaces with jQuery UI

    1. Introduction

    2. Including the Entire jQuery UI Suite

    3. Including an Individual jQuery UI Plugin or Two

    4. Initializing a jQuery UI Plugin with Default Options

    5. Initializing a jQuery UI Plugin with Custom Options

    6. Creating Your Very Own jQuery UI Plugin Defaults

    7. Getting and Setting jQuery UI Plugin Options

    8. Calling jQuery UI Plugin Methods

    9. Handling jQuery UI Plugin Events

    10. Destroying a jQuery UI Plugin

    11. Creating a jQuery UI Music Player

  15. Chapter 15 jQuery UI Theming

    1. Introduction

    2. Styling jQuery UI Widgets with ThemeRoller

    3. Overriding jQuery UI Layout and Theme Styles

    4. Applying a Theme to Non-jQuery UI Components

    5. Referencing Multiple Themes on a Single Page

    6. Appendix: Additional CSS Resources

  16. Chapter 16 jQuery, Ajax, Data Formats: HTML, XML, JSON, JSONP

    1. Introduction

    2. jQuery and Ajax

    3. Using Ajax on Your Whole Site

    4. Using Simple Ajax with User Feedback

    5. Using Ajax Shortcuts and Data Types

    6. Using HTML Fragments and jQuery

    7. Converting XML to DOM

    8. Creating JSON

    9. Parsing JSON

    10. Using jQuery and JSONP

  17. Chapter 17 Using jQuery in Large Projects

    1. Introduction

    2. Using Client-Side Storage

    3. Saving Application State for a Single Session

    4. Saving Application State Between Sessions

    5. Using a JavaScript Template Engine

    6. Queuing Ajax Requests

    7. Dealing with Ajax and the Back Button

    8. Putting JavaScript at the End of a Page

  18. Chapter 18 Unit Testing

    1. Introduction

    2. Automating Unit Testing

    3. Asserting Results

    4. Testing Synchronous Callbacks

    5. Testing Asynchronous Callbacks

    6. Testing User Actions

    7. Keeping Tests Atomic

    8. Grouping Tests

    9. Selecting Tests to Run

  1. Colophon