Pro jQuery

Book description

jQuery is one of the most popular and powerful JavaScript libraries available today. It's widely used to create rich user experiences and to simplify website and application development. It is the tool of choice for web developers everywhere and sets the standard for simplicity, flexibility and extensibility.

In Pro jQuery, seasoned author Adam Freeman explains how to get the most from jQuery by focusing on the features you need for your project. He starts with the nuts and bolts and shows you everything through to advanced features, going in depth to give you the knowledge you need. Getting the most from jQuery is essential to truly mastering web development.

What you'll learn

  • Understand the capabilities of jQuery and why it is special

  • Use the core of jQuery to enrich HTML, including tables, forms and data displays

  • Use jQuery UI to create rich and fluid user experiences

  • Use rich interactions such as drag and drop, sortable data and touch sensitivity

  • Use jQuery Mobile to create touch-enabled interfaces for mobile devices and tablets

  • Extend jQuery by creating custom plugins and widgets

Each topic is covered clearly and concisely, and is packed with the details you'll need to learn to be truly effective with jQuery. The most important features are given a no-nonsense, in-depth treatment, and chapters contain examples that demonstrate both the power and the subtlety of jQuery.

Who this book is for

This book is for working developers who want to learn about jQuery in detail. Quick refreshers of HTML and CSS are given to help you get up to speed, but a good working knowledge of the basics is assumed.

Table of contents

  1. Title
  2. Dedication
  3. Contents at a Glance
  4. Contents
  5. About the Author
  6. About the Technical Reviewer
  7. Acknowledgments
  8. PART 1: Getting Ready
    1. CHAPTER 1: Putting jQuery in Context
      1. Understanding jQuery UI and jQuery Mobile
      2. Understanding jQuery Plugins
      3. What Do I Need to Know?
      4. What Is the Structure of This Book?
      5. Are There Lots of Examples?
      6. Where Can I Get the Example Code?
      7. What Software Do I Need for This Book?
      8. Image Attribution
      9. Summary
    2. CHAPTER 2: HTML Primer
      1. Introducing a Basic HTML Document
      2. Understanding the Anatomy of an HTML Element
      3. Understanding Attributes
      4. Understanding Element Content
      5. Understanding Void Elements
      6. Understanding the Document Structure
      7. Understanding the Element Hierarchy
      8. Understanding the Document Object Model
      9. Summary
    3. CHAPTER 3: CSS Primer
      1. Getting Started with CSS
      2. Setting an Inline Value
      3. Defining an Embedded Style
      4. Defining an External Style Sheet
      5. Understanding CSS Selectors
      6. Understanding Style Cascading
      7. Understanding CSS Units
      8. Using Shorthand Properties and Custom Values
      9. Summary
    4. CHAPTER 4: JavaScript Primer
      1. Getting Ready to Use JavaScript
      2. Using Statements
      3. Defining and Using Functions
      4. Using Variables and Types
      5. Using JavaScript Operators
      6. Working with Arrays
      7. Handling Errors
      8. Comparing undefined and null Values
      9. Summary
  9. PART 2: Working with jQuery
    1. CHAPTER 5: jQuery Basics
      1. Setting Up jQuery
      2. A First jQuery Script
      3. Understanding the jQuery $ Function
      4. Waiting for the Document Object Model
      5. Selecting Elements
      6. Understanding the Selection Result
      7. Modifying Multiple Elements and Chaining Method Calls
      8. Handling Events
      9. Summary
    2. CHAPTER 6: Managing the Element Selection
      1. Expanding the Selection
      2. Narrowing the Selection
      3. Mapping the Selection
      4. Testing the Selection
      5. Changing and Then Unwinding the Selection
      6. Navigating the DOM
      7. Summary
    3. CHAPTER 7: Manipulating the DOM
      1. Creating New Elements
      2. Inserting Child and Descendant Elements
      3. Inserting Parent and Ancestor Elements
      4. Inserting Sibling Elements
      5. Replacing Elements
      6. Removing Elements
      7. Summary
    4. CHAPTER 8: Manipulating Elements
      1. Working with Attributes and Properties
      2. Working with Classes
      3. Working with CSS
      4. Working with Element Content
      5. Working with Form Elements
      6. Associating Data with Elements
      7. Summary
    5. CHAPTER 9: Working with Events
      1. Handling Events
      2. Performing Live Event Binding
      3. Manually Invoking Event Handlers
      4. Using the Event Shorthand Methods
      5. Summary
    6. CHAPTER 10: Using jQuery Effects
      1. Using the Basic Effects
      2. Using the Slide Effects
      3. Using the Fade Effects
      4. Creating Custom Effects
      5. Creating and Managing the Effect Queue
      6. Enabling and Disabling Effect Animations
      7. Summary
    7. CHAPTER 11: Refactoring the Example: Part I
      1. Reviewing the Example Document
      2. Adding Additional Flower Products
      3. Adding the Carousel Buttons
      4. Dealing with the Submit Button
      5. Implementing the Carousel Event Handler Functions
      6. Totaling the Product Selection
      7. Disabling JavaScript
      8. Summary
  10. PART 3: Working with Data and Ajax
    1. CHAPTER 12: Using Data Templates
      1. Understanding the Problem That Templates Solve
      2. Setting Up the jQuery Templates Library
      3. A First Data Templates Example
      4. Using the Template Variables
      5. Using Nested Templates
      6. Using Conditional Templates
      7. Controlling Iteration Over Arrays
      8. Disabling HTML Encoding
      9. Manipulating Templates from Event Handler Functions
      10. Summary
    2. CHAPTER 13: Working with Forms
      1. Preparing the Node.js Server
      2. Recapping the Form Event Methods
      3. Validating Form Values
      4. Summary
    3. CHAPTER 14: Using Ajax: Part I
      1. Using the Ajax Shorthand Methods
      2. Avoiding the Most Common Ajax Pitfall
      3. Using the Type-Specific Convenience Methods
      4. Using the Ajax Forms Plugin
      5. Summary
    4. CHAPTER 15: Using Ajax: Part II
      1. Making a Simple Ajax Request with the Low-Level API
      2. Understanding the jqXHR Object
      3. Setting the Request URL
      4. Making a POST Request
      5. Handling Ajax Events
      6. Using the Global Ajax Events
      7. Configuring the Basic Settings for an Ajax Request
      8. Using More Advanced Configuration Settings
      9. Setting Up and Filtering Ajax Requests
      10. Summary
    5. CHAPTER 16: Refactoring the Example: Part II
      1. Reviewing the Refactored Example
      2. Updating the Node.js Script
      3. Preparing for Ajax
      4. Sourcing the Product Information
      5. Adding Form Validation
      6. Submitting the Form Data Using Ajax
      7. Processing the Server Response
      8. Summary
  11. PART 4: Using jQuery UI
    1. CHAPTER 17: Setting Up jQuery UI
      1. Obtaining jQuery UI
      2. Installing jQuery UI for Development
      3. Installing jQuery UI for Production
      4. Summary
    2. CHAPTER 18: Using the Button, Progress Bar, and Slider Widgets
      1. Using the jQuery UI Button
      2. Creating Different Types of Button
      3. Using the jQuery UI Progress Bar
      4. Using the jQuery UI Slider
      5. Summary
    3. CHAPTER 19: Using the Autocomplete and Accordion Widgets
      1. Using jQuery UI Autocomplete
      2. Using the jQuery UI Accordion
      3. Summary
    4. CHAPTER 20: Using the Tabs Widget
      1. Creating the Tabs
      2. Getting Tab Content with Ajax
      3. Configuring the jQuery UI Tabs
      4. Using the jQuery UI Tabs Methods
      5. Using the jQuery UI Tabs Events
      6. Summary
    5. CHAPTER 21: Using the Datepicker Widget
      1. Creating the Datepicker
      2. Configuring the Datepicker
      3. Using the Datepicker Methods
      4. Using the Datepicker Events
      5. Localizing Date Selection
      6. Summary
    6. CHAPTER 22: Using the Dialog Widget
      1. Creating the Dialog
      2. Configuring the Dialog
      3. Using the Dialog Methods
      4. Using the Dialog Events
      5. Summary
    7. CHAPTER 23: Using the Drag & Drop Interactions
      1. Creating the Draggable Interaction
      2. Using the Droppable Interaction
      3. Tuning Drag and Drop
      4. Summary
    8. CHAPTER 24: Using the Other Interactions
      1. Using the Sortable Interaction
      2. Using the Selectable Interaction
      3. Using the Resizable Interaction
      4. Summary
    9. CHAPTER 25: Refactoring the Example: Part III
      1. Reviewing the Refactored Example
      2. Displaying the Products
      3. Adding the Shopping Basket
      4. Applying the Theme Style
      5. Creating the jQuery UI Button
      6. Adding the Completion Dialog
      7. Handling the Place Order Button Click
      8. Completing the Order
      9. Summary
  12. PART 5: Using jQuery Mobile
    1. CHAPTER 26: Getting Started with jQuery Mobile
      1. Setting Up jQuery Mobile
      2. Understanding the jQuery Mobile Approach
      3. Working with Mobile Devices
      4. Summary
    2. CHAPTER 27: Pages and Navigation
      1. Understanding jQuery Mobile Pages
      2. Using Scripting to Control jQuery Mobile Pages
      3. Using Page Events
      4. Summary
    3. CHAPTER 28: Dialogs, Themes, and Layouts
      1. Creating Dialogs
      2. Applying Themes
      3. Creating Grid Layouts
      4. Summary
    4. CHAPTER 29: Buttons and Collapsible Blocks
      1. Using jQuery Mobile Buttons
      2. Using Collapsible Content Blocks
      3. Summary
    5. CHAPTER 30: Using jQuery Mobile Forms
      1. Understanding Automatically Created Form Elements
      2. Using Select Elements
      3. Creating Check Boxes
      4. Creating Radio Buttons
      5. Using Range Sliders
      6. Summary
    6. CHAPTER 31: jQuery Mobile Lists
      1. Getting Started with Lists
      2. Formatting Lists
      3. Formatting List Items
      4. Summary
    7. CHAPTER 32: Refactoring the Mobile Example: Part IV
      1. Starting with the Basics
      2. Inserting Products Programmatically
      3. Creating the Shopping Basket
      4. Implementing the Checkout Process
      5. Summary
  13. PART 6: Advanced Features
    1. CHAPTER 33: Using the jQuery Utility Methods
      1. Queues Revisited: Using General-Purpose Queues
      2. Utility Methods for Arrays
      3. Utility Methods for Types
      4. Utility Methods for Data
      5. Other Utility Methods
      6. Summary
    2. CHAPTER 34: The jQuery UI Effects & CSS Framework
      1. Using the jQuery UI Effects
      2. Using the jQuery UI CSS Framework
      3. Summary
    3. CHAPTER 35: Using Deferred Objects
      1. A First Deferred Objects Example
      2. Using Other Callbacks
      3. Using Multiple Callbacks
      4. Using the Outcomes of Multiple Deferred Objects
      5. Providing Progress Information
      6. Getting Information about a Deferred Object
      7. Using Ajax Deferred Objects
      8. Summary
  14. Index

Product information

  • Title: Pro jQuery
  • Author(s): Adam Freeman
  • Release date: February 2012
  • Publisher(s): Apress
  • ISBN: 9781430240952