Learning jQuery 1.3

Learning jQuery 1.3
eBook: $23.99
Formats: PDF, PacktLib, ePub and Mobi formats
save 15%!
Print + free eBook + free PacktLib access to the book: $63.98    Print cover: $39.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Table of Contents
Sample Chapters
The newest version of this book is available here:

Learning jQuery, Third Edition Learning jQuery, Third Edition

Available Now.
  • An introduction to jQuery that requires minimal programming experience
  • Detailed solutions to specific client-side problems
  • For web designers to create interactive elements for their designs
  • For developers to create the best user interface for their web applications
  • Packed with great examples, code, and clear explanations
  • Revised and updated version of the first book to help you learn jQuery

Book Details

Language : English
Paperback : 444 pages [ 235mm x 191mm ]
Release Date : February 2009
ISBN : 1847196705
ISBN 13 : 9781847196705
Author(s) : Jonathan Chaffer, Karl Swedberg
Topics and Technologies : All Books, Web Development, AJAX, jQuery, Open Source, Web Development

Table of Contents

Chapter 1: Getting Started
Chapter 2: Selectors
Chapter 3: Events
Chapter 4: Effects
Chapter 5: DOM Manipulation
Chapter 6: AJAX
Chapter 7: Table Manipulation
Chapter 8: Forms with Function
Chapter 9: Shufflers and Rotators
Chapter 10: Using Plugins
Chapter 11: Developing plugins
Appendix A: Online Resources
Appendix B: Development Tools
Appendix C: JavaScript Closures
Appendix D: Quick Reference
  • Chapter 1: Getting Started
    • What jQuery does
    • Why jQuery works well
    • History of the jQuery project
    • Our first jQuery-powered web page
      • Downloading jQuery
      • Setting up the HTML document
      • Adding jQuery
        • Finding the poem text
        • Injecting the new class
        • Executing the code
      • The finished product
    • Summary
  • Chapter 2: Selectors
    • The Document Object Model
    • The $() factory function
    • CSS selectors
      • Styling list-item levels
  • Attribute selectors
    • Styling links
  • Custom selectors
    • Styling alternate rows
    • Form selectors
  • DOM traversal methods
    • Styling specific cells
    • Chaining
  • Accessing DOM elements
  • Summary
  • Chapter 3: Events
    • Performing tasks on page load
      • Timing of code execution
      • Multiple scripts on one page
      • Shortcuts for code brevity
      • Coexisting with other libraries
    • Simple events
      • A simple style switcher
        • Enabling the other buttons
        • Event handler context
        • Further consolidation
      • Shorthand events
    • Compound events
      • Showing and hiding advanced features
      • Highlighting clickable items
    • The journey of an event
      • Side effects of event bubbling
    • Altering the journey: the event object
      • Event targets
      • Stopping event propagation
      • Default actions
      • Event delegation
    • Removing an event handler
      • Event namespacing
      • Rebinding events
    • Simulating user interaction
      • Keyboard events
    • Summary
  • Chapter 4: Effects
    • Inline CSS modification
    • Basic hide and show
    • Effects and speed
      • Speeding in
      • Fading in and fading out
    • Compound effects
    • Creating custom animations
      • Toggling the fade
      • Animating multiple properties
        • Positioning with CSS
    • Simultaneous versus queued effects
      • Working with a single set of elements
      • Working with multiple sets of elements
      • Callbacks
      • In a nutshell
    • Summary
  • Chapter 5: DOM Manipulation
    • Manipulating attributes
      • Non-class attributes
      • The $() factory function revisited
    • Inserting new elements
    • Moving elements
      • Marking, numbering, and linking the context
      • Appending footnotes
    • Wrapping elements
    • Copying elements
      • Clone with events
      • Cloning for pull quotes
      • A CSS diversion
      • Back to the code
      • Prettifying the pull quotes
    • DOM manipulation methods in a nutshell
    • Summary
  • Chapter 6: AJAX
    • Loading data on demand
      • Appending HTML
      • Working with JavaScript objects
        • Retrieving a JavaScript object
        • 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
    • Keeping an eye on the request
    • AJAX and events
    • Security limitations
      • Using JSONP for remote data
    • Additional options
      • The low-level AJAX method
      • Modifying default options
      • Loading parts of an HTML page
    • Summary
  • Chapter 7: Table Manipulation
    • Sorting and paging
      • Server-side sorting
        • Preventing page refreshes
      • JavaScript sorting
        • Row grouping tags
        • Basic alphabetical sorting
        • The power of plugins
        • Performance concerns
        • Finessing the sort keys
        • Sorting other types of data
        • Column highlighting
        • Alternating sort directions
      • Server-side pagination
        • Sorting and paging go together
      • JavaScript pagination
        • Displaying the pager
        • Enabling the pager buttons
        • Marking the current page
        • Paging with sorting
      • The finished code
    • Modifying table appearance
      • Row highlighting
        • Row striping
        • Advanced row striping
        • Interactive row highlighting
      • Tooltips
      • Collapsing and expanding sections
      • Filtering
        • Filter options
        • Reversing the filters
        • Interacting with other code
      • The finished code
    • Summary
  • Chapter 8: Forms with Function
    • Improving a basic form
      • Progressively enhanced form styling
        • The legend
        • Required field messages
      • Conditionally displayed fields
      • Form validation
        • Required fields
        • Required formats
        • A final check
      • Checkbox manipulation
      • The finished code
    • Compact forms
      • Placeholder text for fields
      • AJAX auto-completion
        • On the server
        • In the browser
        • Populating the search field
        • Keyboard navigation
        • Handling the arrow keys
        • Inserting suggestions in the field
        • Removing the suggestion list
        • Auto-completion versus live search
      • The finished code
    • Working with numeric form data
      • Shopping cart table structure
      • Rejecting non-numeric input
      • Numeric calculations
        • Parsing and formatting currency
        • Dealing with decimal places
        • Other calculations
        • Rounding values
        • Finishing touches
      • Deleting items
      • Editing shipping information
      • The finished code
    • Summary
  • Chapter 9: Shufflers and Rotators
    • Headline rotator
      • Setting up the page
      • Retrieving the feed
      • Setting up the rotator
      • The headline rotate function
      • Pause on hover
      • Retrieving a feed from a different domain
        • Adding a loading indicator
      • Gradient fade effect
      • The finished code
    • An image carousel
      • Setting up the page
        • Revising the styles with JavaScript
      • Shuffling images when clicked
        • Adding sliding animation
        • Displaying action icons
      • Image enlargement
        • Hiding the enlarged cover
        • Displaying a close button
        • More fun with badging
        • Animating the cover enlargement
        • Deferring animations until image loads
        • Adding a loading indicator
      • The finished code
    • Summary
  • Chapter 10: Using Plugins
    • Finding plugins and help
    • How to use a plugin
    • The Form plugin
      • Tips and tricks
    • The jQuery UI plugin library
      • Effects
        • Color animations
        • Class animations
        • Advanced easing
        • Additional effects
      • Interaction components
      • Widgets
      • jQuery UI ThemeRoller
    • Other recommended plugins
      • Forms
        • Autocomplete
        • Validation
        • Jeditable
        • Masked input
      • Tables
        • Tablesorter
        • jqGrid
        • Flexigrid
      • Images
        • Jcrop
        • Magnify
      • Lightboxes and Modal Dialogs
        • FancyBox
        • Thickbox
        • BlockUI
        • jqModal
      • Charting
        • Flot
        • Sparklines
      • Events
        • hoverIntent
        • Live query
    • Summary
  • Chapter 11: Developing plugins
    • Adding new global functions
      • Adding multiple functions
      • What's the point?
      • Creating a utility method
    • Adding jQuery Object Methods
      • Object Method context
      • Method chaining
    • DOM traversal methods
    • Adding new shortcut methods
    • Method parameters
      • Simple parameters
      • Parameter maps
      • Default parameter values
      • Callback functions
      • Customizable defaults
    • Adding a selector expression
    • Sharing a plugin with the world
      • Naming conventions
      • Use of the $ alias
      • Method interfaces
      • Documentation style
    • Summary
  • Appendix A: Online Resources
    • jQuery documentation
      • jQuery wiki
      • jQuery API
      • jQuery API browser
      • Visual jQuery
      • Adobe AIR jQueryAPI viewer
    • JavaScript reference
      • Mozilla developer center
      • Dev.opera
      • MSDN JScript Reference
      • Quirksmode
      • JavaScript Toolbox
    • JavaScript code compressors
      • YUI Compressor
      • JSMin
      • Pretty printer
    • (X)HTML reference
      • W3C hypertext markup language home page
    • CSS reference
      • W3C cascading style sheets home page
      • Mezzoblue CSS cribsheet
      • Position is everything
    • Useful blogs
      • The jQuery blog
      • Learning jQuery
      • Ajaxian
      • John Resig
      • JavaScript ant
      • Robert's talk
      • Web standards with imagination
      • Snook
      • Matt Snider JavaScript resource
      • I can't
      • DOM scripting
      • As days pass by
      • A list apart
    • Web development frameworks using jQuery
  • Appendix B: Development Tools
    • Tools for Firefox
      • Firebug
      • Web developer toolbar
      • Venkman
      • Regular expressions tester
    • Tools for Internet Explorer
      • Microsoft Internet Explorer Developer Toolbar
      • Microsoft Visual Web Developer
      • DebugBar
      • Drip
    • Tools for Safari
      • Develop Menu
      • Web Inspector
    • Tools for Opera
      • Dragonfly
    • Other tools
      • Firebug Lite
      • NitobiBug
      • TextMate jQuery bundle
      • Charles
      • Fiddler
      • Aptana
  • Appendix C: JavaScript Closures
    • Inner functions
      • The great escape
      • Variable scoping
    • Interactions between closures
    • Closures in jQuery
      • Arguments to $(document).ready()
      • Event handlers
    • Memory leak hazards
      • Accidental reference loops
      • The Internet Explorer memory leak problem
      • The good news
    • Summary
  • Appendix D: Quick Reference
    • Selector expressions
    • DOM traversal methods
    • Event methods
    • Effect methods
    • DOM manipulation methods
    • AJAX methods
    • Miscellaneous methods

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.

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.


- 4 submitted: last submission 24 Apr 2014

Errata type: Code | Page number: 57

In the function on page 57 event.stopPropagation() should be repaced with event.target.stopPropagation()


Errata type: Code | Page number: 25

$('a [href^=mailto:]') should be $('a[href^="mailto:"]')

and $('a [href$=.pdf]') should be $('a[href$=".pdf"]')


Errata type: Code Download

The code for chapters 7, 8, and 9 of this book are contained in a subdirectory called "bookstore".


Errata type: Code

In the code download, line 621 of bookstore/scripts/tables.js reads:


It should read:




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 1.3 +    Ruby on Rails Enterprise Application Development: Plan, Program, Extend =
50% Off
the second eBook
Price for both: $28.50

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

What you will learn from this book

This book will give you the tools you need to be on the cutting edge of the web development community. With these techniques at your disposal, you can:

  • Use selectors to get anything you want from a page
  • Make things happen on your page with events
  • Add flair to your actions with animation effects
  • Change your page on command with DOM manipulation
  • Use AJAX to get the most out of server-side code
  • Transform drab, static information containers into beautiful, dynamic tables
  • Breathe new life into online forms
  • Create dynamic shufflers, rotators, and galleries
  • Get started with official jQuery plug-ins
  • Customize by writing your own jQuery plug-ins

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.

Revised and updated for version 1.3 of jQuery, this book teaches you 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.

In this book, the authors share their knowledge, experience, and enthusiasm about jQuery to help you get the most from the library and to make your web applications shine. The book introduces jQuery and shows how you can write a functioning jQuery program in just three lines of code. It then guides you through CSS selectors and shows how to enhance the basic event handling mechanisms to give them a more elegant syntax. You will then learn to add impact to your actions through a set of simple visual effects and also to create, copy, reassemble, and embellish content using jQuery's DOM modification methods. You will also learn to send and retrieve information with AJAX methods. The book will then step you through many detailed, real-world examples and even equip you to extend the jQuery library itself with your own plug-ins.

Packed with great examples and clear explanations, this revised and updated version of Learning jQuery teaches you how to use jQuery 1.3.


This book begins with a tutorial to jQuery, followed by an examination of common, real-world client-side problems, and solutions to each of them making it an invaluable resource for answers to all your jQuery questions.

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 knowledge is required. You will need to know the basics of HTML and CSS, and should be comfortable with the syntax of JavaScript. No knowledge of jQuery is assumed, nor is experience with any other JavaScript libraries required.

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
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