You are previewing Pro jQuery 2.0, Second Edition.
O'Reilly logo
Pro jQuery 2.0, Second Edition

Book Description

jQuery 2.0 is the latest version of the jQuery framework. Suitable for modern web browsers it provides a robust API for web application development. It is fast becoming the tool of choice for web developers the world over and sets the standard for simplicity,flexibility and extensibility in website design.

In Pro jQuery 2.0 seasoned author, Adam Freeman, demonstrates how to get the most from jQuery 2.0 by focussing on the practical features of the technology and how they can be applied to solving real-world problems. In this comprehensive reference he goes in depth to give you the practical knowledge that you need.

Each topic is covered clearly and concisely, and is packed with the details you'll need to learn to be truly effective. 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.

What you'll learn

  • Understand the capabilities of jQuery and why it is special

  • Use the core of jQuery to enrich HTML5, 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

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.

The advice given in this book is relevant to developers working with any development environment. The examples are demonstrated using Microsoft Windows and Visual Studio but are equally applicable to any other web development environment.

Table of Contents

  1. Title Page
  2. Dedication
  3. Contents at a Glance
  4. Contents
  5. About the Author
  6. About the Technical Reviewer
  7. Acknowledgments
  8. CHAPTER 1: Putting jQuery in Context
    1. Understanding jQuery UI and jQuery Mobile
    2. Understanding jQuery Plug-ins
    3. What Do I Need to Know?
    4. What Is the Structure of This Book?
    5. What’s New in This Edition?
    6. Are There Lots of Examples?
    7. Where Can I Get the Example Code?
    8. What Software Do I Need for This Book?
    9. Image Attribution
    10. Summary
  9. 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
  10. 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
  11. 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
  12. 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
  13. 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
  14. 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
  15. 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
  16. 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
  17. 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
  18. 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
  19. CHAPTER 12: Using Data Templates
    1. Understanding the Problem That Templates Solve
    2. Setting Up the Template Library
    3. A First Data Templates Example
    4. Using Template Logic
    5. Creating Custom Template Helpers
    6. Summary
  20. CHAPTER 13: Working with Forms
    1. Preparing the Node.js Server
    2. Recapping the Form-Event Methods
    3. Validating Form Values
    4. Summary
  21. 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 Plug-in
    5. Summary
  22. 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 Callbacks
    6. Using the Global Ajax Events
    7. Configuring the Basic Settings for an Ajax Request
    8. Using Advanced Configuration Settings
    9. Setting Up and Filtering Ajax Requests
    10. Summary
  23. 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
  24. CHAPTER 17: Setting Up jQuery UI
    1. Obtaining jQuery UI
    2. Installing jQuery UI for Development
    3. Installing jQuery UI for Production
    4. Summary
  25. 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
  26. CHAPTER 19: Using the Autocomplete and Accordion Widgets
    1. Using jQuery UI Autocomplete
    2. Using the jQuery UI Accordion
    3. Summary
  27. CHAPTER 20: Using the Tabs Widget
    1. Creating the Tabs
    2. Getting Tab Content with Ajax
    3. Configuring the Tabs Widget
    4. Using the Tabs Methods
    5. Using the Tabs Events
    6. Summary
  28. 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
  29. CHAPTER 22: Using the Dialog and Spinner Widgets
    1. Using the jQuery UI Dialog Widget
    2. Using the jQuery UI Spinner Widget
    3. Summary
  30. CHAPTER 23: Using the Menu and Tooltip Widgets
    1. Using the jQuery UI Menu Widget
    2. Using the jQuery UI Tooltip Widget
    3. Summary
  31. CHAPTER 24: Using the Drag-and-Drop Interactions
    1. Creating the Draggable Interaction
    2. Using the Droppable Interaction
    3. Tuning Drag and Drop
    4. Summary
  32. CHAPTER 25: Using the Other Interactions
    1. Using the Sortable Interaction
    2. Using the Selectable Interaction
    3. Using the Resizable Interaction
    4. Summary
  33. CHAPTER 26: 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
  34. CHAPTER 27: Getting Started with jQuery Mobile
    1. Setting Up jQuery Mobile
    2. Understanding the jQuery Mobile Approach
    3. Working with Mobile Devices
    4. Summary
  35. CHAPTER 28: Pages, Themes & Layouts
    1. Understanding jQuery Mobile Pages
    2. Using Scripting to Control jQuery Mobile Pages
    3. Using Page Events
    4. Applying jQuery Mobile Themes
    5. Creating Grid Layouts
    6. Summary
  36. CHAPTER 29: The Dialog & Popup Widgets
    1. Using the jQuery Mobile Dialog Widget
    2. Using the jQuery Mobile Popup Widget
    3. Summary
  37. CHAPTER 30: Buttons and Collapsible Blocks
    1. Using jQuery Mobile Buttons
    2. Using jQuery Mobile NavBars
    3. Using Collapsible Content Blocks
    4. Using jQuery Mobile Collapsible Sets (Accordions)
    5. Summary
  38. CHAPTER 31: Using jQuery Mobile Forms
    1. Creating Form Element Widgets
    2. Using the Textinput Widget
    3. Using the Slider and Range Slider Widgets
    4. Using the Selectmenu Widget
    5. Using Flip Switches
    6. Using the Checkboxradio Widget
    7. Summary
  39. CHAPTER 32: Using Lists and Panels
    1. Using the ListView Widget
    2. Using the Panel Widget
    3. Summary
  40. CHAPTER 33: Refactoring the Example: Part IV
    1. Starting with the Basics
    2. Inserting Products Programmatically
    3. Creating the Shopping Basket
    4. Implementing the Checkout Process
    5. Summary
  41. CHAPTER 34: 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
  42. CHAPTER 35: The jQuery UI Effects & CSS Framework
    1. Using the jQuery UI Effects
    2. Using the jQuery UI CSS Framework
    3. Summary
  43. CHAPTER 36: 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
  44. Index