Learning jQuery - Fourth Edition


Learning jQuery - Fourth Edition
eBook: $23.99
Formats: PDF, PacktLib, ePub and Mobi formats
$20.39
save 15%!
Print + free eBook + free PacktLib access to the book: $63.98    Print cover: $39.99
$39.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Overview
Table of Contents
Author
Support
Sample Chapters
  • An introduction to jQuery that requires minimal programming experience
  • Detailed solutions to specific client-side problems
  • Revised and updated version of this popular jQuery book

Book Details

Language : English
Paperback : 444 pages [ 235mm x 191mm ]
Release Date : June 2013
ISBN : 178216314X
ISBN 13 : 9781782163145
Author(s) : Jonathan Chaffer, Karl Swedberg
Topics and Technologies : All Books, Web Development, jQuery, Open Source

Table of Contents

Preface
Chapter 1: Getting Started
Chapter 2: Selecting Elements
Chapter 3: Handling Events
Chapter 4: Styling and Animating
Chapter 5: Manipulating the DOM
Chapter 6: Sending Data with Ajax
Chapter 7: Using Plugins
Chapter 8: Developing Plugins
Chapter 9: Advanced Selectors and Traversing
Chapter 10: Advanced Events
Chapter 11: Advanced Effects
Chapter 12: Advanced DOM Manipulation
Chapter 13: Advanced Ajax
Appendix A: JavaScript Closures
Appendix B: Testing JavaScript with QUnit
Appendix C: Quick Reference
Index
  • Chapter 1: Getting Started
    • What jQuery does
    • Why jQuery works well
    • Making our first jQuery-powered web page
      • Downloading jQuery
      • Deciding on the version of jQuery to use
      • Setting up jQuery in an HTML document
      • Adding our jQuery code
        • Finding the poem text
        • Injecting the new class
        • Executing the code
      • The finished product
    • Plain JavaScript versus jQuery
    • Using development tools
      • Chrome Developer Tools
    • Summary
    • Chapter 2: Selecting Elements
      • Understanding the DOM
      • Using the $() function
      • CSS selectors
        • Styling list-item levels
      • Attribute selectors
        • Styling links
      • Custom selectors
        • Styling alternate rows
        • Finding elements based on textual content
        • Form selectors
      • DOM traversal methods
        • Styling specific cells
        • Chaining
      • Accessing DOM elements
      • Summary
        • Further reading
      • Exercises
      • Chapter 3: Handling Events
        • Performing tasks on page load
          • Timing of code execution
          • Handling multiple scripts on one page
          • Alternate syntax for .ready()
          • Passing an argument to the .ready() callback
        • Handling simple events
          • A simple style switcher
          • Enabling the other buttons
          • Making use of the event handler context
          • Consolidating code using the event context
          • Shorthand events
          • Showing and hiding advanced features
        • Event propagation
          • The journey of an event
          • Side effects of event bubbling
        • Altering the journey – the event object
          • Event targets
          • Stopping event propagation
          • Preventing default actions
          • Delegating events
          • Using built-in event-delegation capabilities
        • Removing an event handler
          • Giving namespaces to event handlers
          • Rebinding events
        • Simulating user interaction
          • Reacting to keyboard events
        • Summary
          • Further reading
        • Exercises
        • Chapter 4: Styling and Animating
          • Modifying CSS with inline properties
            • Setting computed style-property values
            • Using vendor-specific style properties
          • Hiding and showing elements
          • Effects and duration
            • Speeding in
            • Fading in and fading out
            • Sliding up and sliding down
            • Toggling visibility
          • Creating custom animations
            • Building effects by hand
            • Animating multiple properties at once
              • Positioning with CSS
          • Simultaneous versus queued effects
            • Working with a single set of elements
              • Bypassing the queue
              • Queuing effects manually
            • Working with multiple sets of elements
              • Queuing with callbacks
            • In a nutshell
          • Summary
            • Further reading
          • Exercises
          • Chapter 5: Manipulating the DOM
            • Manipulating attributes and properties
              • Non-class attributes
                • Value callbacks
              • DOM element properties
              • The value of form controls
            • DOM tree manipulation
              • The $() function revisited
              • Creating new elements
              • Inserting new elements
              • Moving elements
              • Wrapping elements
                • Explicit iteration
              • Using inverted insertion methods
            • Copying elements
              • Cloning for pull quotes
            • Content getter and setter methods
            • DOM manipulation methods in a nutshell
            • Summary
              • Further reading
            • Exercises
            • Chapter 6: Sending Data with Ajax
              • Loading data on demand
                • Appending HTML
                • Working with JavaScript objects
                  • Retrieving JSON
                  • Using global jQuery functions
                  • Executing a script
                • Loading an XML document
              • Choosing a data format
              • Passing data to the server
                • Performing a GET request
                • Performing a POST request
                • Serializing a form
              • Delivering different content for Ajax requests
              • Keeping an eye on the request
              • Error handling
              • Ajax and events
              • Security limitations
                • Using JSONP for remote data
              • Exploring additional options
                • The low-level Ajax method
                • Modifying default options
                • Loading parts of an HTML page
              • Summary
                • Further reading
              • Exercises
              • Chapter 7: Using Plugins
                • Finding plugins and help
                • Using a plugin
                  • Downloading and referencing the Cycle plugin
                  • Calling a plugin method
                  • Specifying plugin method parameters
                  • Modifying parameter defaults
                • Other types of plugins
                  • Custom selectors
                  • Global function plugins
                • The jQuery UI plugin library
                  • Effects
                    • Color animations
                    • Class animations
                    • Advanced easing
                    • Additional effects
                  • Interaction components
                  • Widgets
                  • jQuery UI ThemeRoller
                • The jQuery Mobile plugin library
                  • HTML5 custom data attributes
                  • Mobile navigation
                  • Delivering multiple pages in one document
                  • Interactive elements
                    • List views
                    • Toolbar buttons
                  • Advanced features
                • Summary
                • Exercises
                • Chapter 8: Developing Plugins
                  • Using the dollar ($) alias in plugins
                  • Adding new global functions
                    • Adding multiple functions
                      • Extending the global jQuery object
                      • Isolating functions within namespaces
                  • Adding jQuery object methods
                    • Object method context
                    • Implicit iteration
                    • Enabling method chaining
                  • Providing flexible method parameters
                    • The options object
                    • Default parameter values
                    • Callback functions
                    • Customizable defaults
                  • Creating plugins with the jQuery UI widget factory
                    • Creating a widget
                    • Destroying widgets
                    • Enabling and disabling widgets
                    • Accepting widget options
                    • Adding submethods
                    • Triggering widget events
                  • Plugin design recommendations
                    • Distributing a plugin
                  • Summary
                  • Exercises
                  • Chapter 9: Advanced Selectors and Traversing
                    • Selecting and traversing revisited
                      • Dynamic table filtering
                      • Striping table rows
                      • Combining filtering and striping
                      • More selectors and traversal methods
                    • Customizing and optimizing selectors
                      • Writing a custom selector plugin
                      • Selector performance
                        • The Sizzle selector implementation
                        • Testing selector speed
                    • DOM traversal under the hood
                      • jQuery object properties
                      • The DOM element stack
                      • Writing a DOM traversal method plugin
                      • DOM traversal performance
                        • Improving performance using chaining
                        • Improving performance with caching
                    • Summary
                      • Further reading
                    • Exercises
                    • Chapter 10: Advanced Events
                      • Revisiting events
                        • Loading additional pages of data
                        • Displaying data on hovering
                      • Event delegation
                        • Using jQuery's delegation capabilities
                        • Choosing a delegation scope
                        • Delegating early
                      • Defining custom events
                        • Infinite scrolling
                        • Custom event parameters
                      • Throttling events
                        • Other ways to perform throttling
                      • Extending events
                        • More about special events
                      • Summary
                      • Further reading
                      • Exercises
                      • Chapter 11: Advanced Effects
                        • Animation revisited
                        • Observing and interrupting animations
                          • Determining the animation state
                          • Halting a running animation
                            • Caution when halting animations
                        • Using global effect properties
                          • Disabling all effects
                          • Defining effect durations
                        • Multiproperty easing
                        • Using deferred objects
                          • Animation promises
                        • Taking fine-grained control of animations
                        • Summary
                          • Further reading
                        • Exercises
                        • Chapter 12: Advanced DOM Manipulation
                          • Sorting table rows
                            • Sorting tables on the server
                            • Sorting tables using Ajax
                            • Sorting tables within the browser
                          • Moving and inserting elements revisited
                            • Adding links around existing text
                            • Sorting simple JavaScript arrays
                            • Sorting DOM elements
                          • Storing data alongside DOM elements
                            • Performing additional precomputation
                            • Storing non-string data
                            • Alternating sort directions
                          • Using HTML5 custom data attributes
                          • Sorting and building rows with JSON
                            • Modifying the JSON object
                            • Rebuilding content on demand
                          • Revisiting attribute manipulation
                            • Using shorthand element-creation syntax
                            • DOM manipulation hooks
                              • Writing a CSS hook
                          • Summary
                            • Further reading
                          • Exercises
                          • Chapter 13: Advanced Ajax
                            • Implementing progressive enhancement with Ajax
                              • Harvesting JSONP data
                            • Handling Ajax errors
                            • Using the jqXHR object
                              • Ajax promises
                              • Caching responses
                            • Throttling Ajax requests
                            • Extending Ajax capabilities
                              • Data type converters
                              • Adding Ajax prefilters
                              • Defining alternate transports
                            • Summary
                              • Further reading
                            • Exercises
                            • Appendix A: JavaScript Closures
                              • Creating inner functions
                                • Calling inner functions from elsewhere
                                • Understanding variable scope
                              • Handling interactions between closures
                              • Creating closures in jQuery
                                • Passing arguments to $(document).ready()
                                • Assigning event handlers
                                • Binding handlers in loops
                                • Giving names to functions
                              • Handling memory-leak hazards
                                • Avoiding accidental reference loops
                                • Managing loops between the DOM and JavaScript
                                  • Disentangling reference loops with jQuery
                              • Summary
                              • Appendix B: Testing JavaScript with QUnit
                                • Downloading QUnit
                                • Setting up the document
                                • Organizing tests
                                • Adding and running tests
                                  • Asynchronous testing
                                • Other types of tests
                                • Practical considerations
                                  • Further reading
                                • Summary
                                • Appendix C: Quick Reference
                                  • Selector expressions
                                    • Simple CSS
                                    • Position among siblings
                                    • Position among matched elements
                                    • Attributes
                                    • Forms
                                    • Miscellaneous selectors
                                  • DOM traversal methods
                                    • Filtering
                                    • Descendants
                                    • Siblings
                                    • Ancestors
                                    • Collection manipulation
                                    • Working with selected elements
                                  • Event methods
                                    • Binding
                                    • Shorthand binding
                                    • Triggering
                                    • Shorthand triggering
                                    • Utility
                                  • Effect methods
                                    • Predefined effects
                                    • Custom animations
                                    • Queue manipulation
                                  • DOM manipulation methods
                                    • Attributes and properties
                                    • Content
                                    • CSS
                                    • Dimensions
                                    • Insertion
                                    • Replacement
                                    • Removal
                                    • Copying
                                    • Data
                                  • Ajax methods
                                    • Issuing requests
                                    • Request monitoring
                                    • Configuration
                                    • Utilities
                                  • Deferred objects
                                    • Object creation
                                    • Methods of deferred objects
                                    • Methods of promise objects
                                  • Miscellaneous properties and functions
                                    • Properties of the jQuery object
                                    • Arrays and objects
                                    • Object introspection
                                    • Other

                                  Jonathan Chaffer

                                  Jonathan Chaffer is a member of Rapid Development Group, a web development firm located in Grand Rapids, Michigan. His work there includes overseeing and implementing projects in a wide variety of technologies, with an emphasis in PHP, MySQL, and JavaScript. He also leads on-site training seminars on the jQuery framework for web developers. In the open source community, he has been very active in the Drupal CMS project, which has adopted jQuery as its JavaScript framework of choice. He is the creator of the Content Construction Kit, a popular module for managing structured content on Drupal sites. He is also responsible for major overhauls of Drupal's menu system and developer API reference. He lives in Grand Rapids with his wife, Jennifer.

                                  Karl Swedberg

                                  Karl Swedberg is a web developer at Fusionary Media in Grand Rapids, Michigan, where he spends much of his time making cool things happen with JavaScript. As a member of the jQuery team, he is responsible for maintaining the jQuery API site at api.jquery.com. He is also a member of jQuery's Board of Advisors and a presenter at workshops and conferences. When he isn't coding, he likes to hang out with his family, roast coffee in his garage, and exercise at the local CrossFit gym.
                                  Sorry, we don't have any reviews for this title yet.

                                  Code Downloads

                                  Download the code and support files for this book.


                                  Submit Errata

                                  Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.


                                  Errata

                                  - 6 submitted: last submission 04 Feb 2014

                                  Errata Type: Code | Page number: 31

                                  In Listing 2.2,

                                  $('#selected-plays li:not(.horizontal)').addClass('sub-level');li:not(.horizontal)').addClass('sub-level');

                                  should be

                                  $('#selected-plays li:not(.horizontal)').addClass('sub-level');

                                   

                                   

                                  Errata Type: Code | Page number: 46

                                  varmyTag = $('#my-element').get(0).tagName;

                                  Should be

                                  var myTag = $('#my-element').get(0).tagName;


                                  Errata Type: Code | Page number: 46

                                  varmyTag = $('#my-element')[0].tagName;

                                  Should be

                                  var myTag = $('#my-element')[0].tagName;

                                  Errata Type: Code | Page Number: 74

                                  In listing 3.17, the code reads in line number 2:
                                   var bodyClass = event.target.id.split('-')[1];

                                   It should instead be:
                                   var bodyClass = this.id.split('-')[1]; 

                                  Errata Type: Code | Page Number: 29

                                  The line after the Downloading code examples tip reads:

                                  Notice that the first <ul> has an ID of selecting-plays

                                  It should instead be:

                                  Notice that the first <ul> has an ID of selected-plays

                                   


                                  Errata Type: Code | Page Number: 33

                                  The ending }); just above Listing 2.5 must be omitted 

                                  Sample chapters

                                  You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

                                  Frequently bought together

                                  Learning jQuery - Fourth Edition +    jQuery 2.0 Development Cookbook =
                                  50% Off
                                  the second eBook
                                  Price for both: ₨444.80

                                  Buy both these recommended eBooks together and get 50% off the cheapest eBook.

                                  What you will learn from this book

                                  • Create interactive elements for your web designs
                                  • Learn how to create the best user interface for your web applications
                                  • Use selectors in a variety of ways to get anything you want from a page
                                  • Make things happen on your webpages with events
                                  • Add flair to your actions with a variety of animation effects
                                  • Discover the new features available in jQuery in this third update of this popular jQuery book

                                  In Detail

                                  To build interesting, interactive sites, developers are turning to JavaScript libraries such as jQuery to automate common tasks and simplify complicated ones. Because many web developers have more experience with HTML and CSS than with JavaScript, the library's design lends itself to a quick start for designers with little programming experience. Experienced programmers will also be aided by its conceptual consistency.

                                  LearningjQuery - Fourth Edition is revised and updated version of jQuery. You will learn the basics of jQuery for adding interactions and animations to your pages. Even if previous attempts at writing JavaScript have left you baffled, this book will guide you past the pitfalls associated with AJAX, events, effects, and advanced JavaScript language features.

                                  Starting with an introduction to jQuery, you will first be shown how to write a functioning jQuery program in just three lines of code. Learn how to add impact to your actions through a set of simple visual effects and to create, copy, reassemble, and embellish content using jQuery's DOM modification methods. The book will take you through many detailed, real-world examples, and even equip you to extend the jQuery library itself with your own plug-ins.

                                  Approach

                                  We will step through each of the core concepts of the jQuery library, building an overall picture of its capabilities. Once you have thoroughly covered the basics, the book returns to each concept to cover more advanced examples and techniques.

                                  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 and knowledge of HTML and CSS is required. No knowledge of jQuery is assumed, nor is experience with any other JavaScript libraries.

                                  Code Download and Errata
                                  Packt Anytime, Anywhere
                                  Register Books
                                  Print Upgrades
                                  eBook Downloads
                                  Video Support
                                  Contact Us
                                  Awards Voting Nominations Previous Winners
                                  Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
                                  Resources
                                  Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software