jQuery Reference Guide

There is a newer version of this book available - jQuery 1.4 Reference Guide
jQuery Reference Guide
eBook: $23.99
Formats: PDF, PacktLib, ePub and Mobi formats
save 45%!
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
  • Organized menu to every method, function, and selector in the jQuery library
  • Quickly look up features of the jQuery library
  • Understand the anatomy of a jQuery script
  • Extend jQuery's built-in capabilities with plug-ins, and even write your own


Book Details

Language : English
Paperback : 268 pages [ 235mm x 191mm ]
Release Date : July 2007
ISBN : 1847193811
ISBN 13 : 9781847193810
Author(s) : Jonathan Chaffer, Karl Swedberg
Topics and Technologies : All Books, Web Development, AJAX, jQuery, Open Source, Web Development

Table of Contents

Chapter 1: Anatomy of a jQuery Script
Chapter 2: Selector Expressions
Chapter 3: DOM Traversal Methods
Chapter 4: DOM Manipulation Methods
Chapter 5: Event Methods
Chapter 6: Effect Methods
Chapter 7: AJAX Methods
Chapter 8: Miscellaneous Methods
Chapter 9: Plug-In API
Chapter 10: Dimensions Plug-In
Chapter 11: Form Plug-In
Appendix A: Online Resources
Appendix B: Development Tools
  • Chapter 1: Anatomy of a jQuery Script
    • A Dynamic Table of Contents
      • Obtaining jQuery
      • Setting Up the HTML Document
      • Writing the jQuery Code
    • Script Dissection
      • Selector Expressions
      • DOM Traversal Methods
      • DOM Manipulation Methods
      • Event Methods
      • Effect Methods
      • AJAX Methods
      • Miscellaneous Methods
      • Plug-In API
    • Summary
  • Chapter 2: Selector Expressions
    • CSS Selectors
      • Element: T
      • ID: #myid
      • Class: .myclass
      • Descendant: E F
      • Child: E > F
      • Adjacent Sibling: E + F
      • General Sibling: E ~ F
      • Multiple Elements: E,F,G
      • Nth Child (:nth-child(n))
      • First Child (:first-child)
      • Last Child (:last-child)
      • Only Child :only-child
      • Not :not(s)
      • Empty :empty
      • Universal: *
    • XPath Selectors
      • Descendant: E//F
      • Child: E/F
      • Parent: E/..
      • Contains: [F]
    • Attribute Selectors
      • Has Attribute: [@foo]
      • Attribute Value Equals: [@foo=bar]
      • Attribute Value Does Not Equal: [@foo!=bar]
      • Attribute Value Begins: [@foo^=bar]
      • Attribute Value Ends: [@foo$=bar]
      • Attribute Value Contains: [@foo*=bar]
    • Form Selectors
    • Custom Selectors
      • Even Element (:even) Odd Element (:odd)
      • Nth Element (:eq(n), :nth(n))
      • Greater Than :gt(n)
      • Less Than : lt(n)
      • First :first
      • Last :last
      • Parent :parent
      • Contains :contains(text)
      • Visible :visible
      • Hidden :hidden
  • Chapter 3: DOM Traversal Methods
    • The jQuery Factory Function
    • $()
    • Filtering Methods
      • .filter()
      • .not()
      • .contains()
      • .eq()
      • .lt()
      • .gt()
    • Tree Traversal Methods
      • .find()
      • .children()
      • .parents()
      • .parent()
      • .siblings()
      • .prev()
      • .next()
    • Miscellaneous Traversal Methods
      • .add()
      • .is()
      • .end()
  • Chapter 4: DOM Manipulation Methods
    • General Attributes
      • .attr(attribute)
      • .attr()
      • .removeAttr()
    • Style Properties
      • .css(property)
      • .css()
      • .height()
      • .height(value)
      • .width()
      • .width(value)
    • Class Attribute
      • .addClass()
      • .removeClass()
      • .toggleClass()
    • DOM Replacement
      • .html()
      • .html(HTML)
      • .text()
      • .text(text)
      • .val()
      • .val(value)
    • DOM Insertion, Inside
      • .prepend()
      • .prependTo()
      • .append()
      • .appendTo()
    • DOM Insertion, Outside
      • .before()
      • .insertBefore()
      • .after()
      • .insertAfter()
    • DOM Insertion, Around
      • .wrap()
    • DOM Copying
      • .clone()
    • DOM Removal
      • .empty()
      • .remove()
  • Chapter 5: Event Methods
    • Event Handler Attachment
      • .bind()
      • .unbind()
      • .one()
      • .trigger()
    • Document Loading
      • $()
      • .load()
      • .unload()
      • .error()
    • Mouse Events
      • .mousedown()
      • .mouseup()
      • .click()
      • .dblclick()
      • .toggle()
      • .mouseover()
      • .mouseout()
      • .hover()
      • .mousemove()
    • Form Events
      • .focus()
      • .blur()
      • .change()
      • .select()
      • .submit()
    • Keyboard Events
      • .keydown()
      • .keypress()
      • .keyup()
    • Browser Events
      • .resize()
      • .scroll()
  • Chapter 6: Effect Methods
    • Pre-Packaged Effects
      • .show()
      • .hide()
      • .toggle()
      • .slideDown()
      • .slideUp()
      • .slideToggle()
      • .fadeIn()
      • .fadeOut()
      • .fadeTo()
    • Customized Effects
      • .animate()
  • Chapter 7: AJAX Methods
    • Low-Level Interface
      • $.ajax()
      • $.ajaxSetup()
    • Shorthand Methods
      • $.get()
      • $.getIfModified()
      • .load()
      • .loadIfModified()
      • $.post()
      • $.getJSON()
      • $.getScript()
    • Global AJAX Event Handlers
      • .ajaxComplete()
      • .ajaxError()
      • .ajaxSend()
      • .ajaxStart()
      • .ajaxStop()
      • .ajaxSuccess()
    • Helper Function
      • .serialize()
  • Chapter 8: Miscellaneous Methods
    • Setup Methods
      • $.browser
      • $.noConflict()
    • DOM Element Methods
      • .length
      • .size()
      • .get()
      • .index()
    • Collection Manipulation
      • .each()
      • $.grep()
      • $.map()
      • $.merge()
      • $.unique()
      • $.extend()
      • $.trim()
  • Chapter 9: Plug-In API
    • Using a Plug-in
    • Developing a Plug-in
      • Object Method
      • Global Function
      • Selector Expression
      • Easing Style
    • Example: Maintaining Multiple Event Logs
    • Summary
  • Chapter 10: Dimensions Plug-In
    • Size Methods
      • .height()
      • .width()
      • .innerHeight()
      • .innerWidth()
      • .outerHeight()
      • .outerWidth()
    • Position Methods
      • .scrollTop()
      • .scrollTop(value)
      • .scrollLeft()
      • .scrollLeft(value)
      • .offset()
      • .position()
  • Chapter 11: Form Plug-In
    • AJAX Form Submission
      • .ajaxSubmit()
      • .ajaxForm()
      • .ajaxFormUnbind()
    • Retrieving Form Values
      • .formToArray()
      • .formSerialize()
      • .fieldSerialize()
      • .fieldValue()
    • Form Manipulation
      • .clearForm()
      • .clearFields()
      • .resetForm()
  • Appendix A: Online Resources
    • jQuery Documentation
    • JavaScript Reference
    • JavaScript Code Compressors
    • (X)HTML Reference
    • CSS Reference
    • XPath Reference
    • Useful Blogs
    • Web Development Frameworks Using jQuery

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.


- 2 submitted: last submission 28 Feb 2014

page 27 Other 08 Apr 09
In jQuery 1.3 [@attr] style selectors were removed (they were previously deprecated<br />in jQuery 1.2). Simply remove the '@' symbol from your selectors in order to make<br />them work again. The new book (Learning jQuery 1.3) is updated with API changes such<br />as this. ISBN 2509 was written for 1.1, and is largely compatible with 1.2.
page 72 typo 26 Mar 09
In this example code:<br />$('div.demo-container'>.html('<p...');<br />Instead > before .html there should be ).<br />The code should be $('div.demo-container').html('<p...');
page 83 Other 31 Mar 09
.insertBefore() method is described with parameter content (.insertBefore(content)) <br />The text is correct as printed, but would be clearer if the variable were named<br />"target" rather than "content" to be consistent with other examples.
page 225 typo 26 Mar 09
"Given the form illustrated in the .ajaxFor()...."<br />It should be <br />"Given the form illustrated in the .ajaxForm()...."<br />

Page 72 Errata type: Code

Section ".html(HTML)": $('div.demo-container'>.html('

All new content. You bet!'); The ">" just before the ".html" should be a ")".

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

jQuery Reference Guide +    Python Geospatial Development - Second Edition =
50% Off
the second eBook
Price for both: $36.65

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

What you will learn from this book

  • Get a broad overview of the jQuery library's capabilities with a real-world example
  • Examine any jQuery method, function, and selector in detail, wherever and whenever it is needed
  • Investigate jQuery's plug-in architecture, using a variety of approaches to extend the library's capabilities
  • Explore the Dimensions plug-in for getting the size and position of any element on the page—even the document and browser window
  • Discover the Form plug-in for combining AJAX techniques with HTML forms

In Chapter 1, Anatomy of a jQuery Script, we begin by dissecting a working jQuery example. This script will serve as a roadmap for this book, directing you to the chapters containing more information on particular jQuery capabilities.

The heart of the book is a set of reference chapters that allow you to quickly look up the details of any jQuery method. Chapter 2, Selector Expressions, lists every available selector for finding page elements.

Chapter 3, DOM Traversal Methods, builds on the previous chapter with a catalog of jQuery methods for finding page elements.

Chapter 4, DOM Manipulation Methods, describes every opportunity for inspecting and modifying the HTML structure of a page.

Chapter 5, Event Methods, details each event that can be triggered and reacted to by jQuery.

Chapter 6, Effect Methods, defines the range of animations built into jQuery, as well as the toolkit available for building your own.

Chapter 7, AJAX Methods lists the ways in which jQuery can initiate and respond to server communication without refreshing the page.

Chapter 8, Miscellaneous Methods, covers the remaining capabilities of the jQuery library that don't neatly fit into the other categories.

In the final three chapters, we dive into the extension mechanisms jQuery makes available. Chapter 9, Plug-in API, reveals four major ways to enhance jQuery's already robust capabilities using a plug-in. The chapter shows how to use plug-ins and we develop a custom plug-in from the ground up.

Chapter 10, Dimensions Plug-in, walks you through the advanced measurement tools available in this popular plug-in.

Chapter 11, Form Plug-in, empowers you to bring AJAX technology and HTML forms together, a process which is made easy by this plug-in.

Appendix A, Online Resources, provides a handful of informative websites on a wide range of topics related to jQuery, JavaScript, and web development in general.

Appendix B, Development Tools, recommends a number of useful third-party programs and utilities for editing and debugging jQuery code within your personal development environment.

In Detail

jQuery is a powerful, yet easy-to-use JavaScript library that helps web developers and designers add dynamic, interactive elements to their sites, smoothing out browser inconsistencies and greatly reducing development time. In this book, the creators of the popular jQuery learning resource, learningquery.com, share their knowledge, experience, and enthusiasm to bring you a comprehensive reference to the popular JavaScript library.

This book offers an organized menu of every jQuery method, function, and selector. Each method and function is introduced with a summary of its syntax and a list of its parameters and return value, followed by a discussion, with examples where applicable, to assist in getting the most out of jQuery and avoiding the pitfalls commonly associated with JavaScript and other client-side languages.

If you're already familiar with JavaScript programming, this book will help you dive right into advanced jQuery concepts. You'll be able to experiment on your own, trusting the pages of this book to provide information on the intricacies of the library, where and when you need it. If you're still hungry for more, the book shows you how to cook up your own extensions with jQuery's elegant plug-in architecture.

This book is a companion to Learning jQuery: Better Interaction Design and Web Development with Simple JavaScript Techniques.
Learning jQuery begins with a tutorial to jQuery, followed by an examination of common, real-world client-side problems, and solutions for each of them, making it an invaluable resource for answers to all your jQuery questions.

jQuery Reference Guide digs deeper into the library, taking you through the syntax specifications and following up with a detailed discussion. You'll discover the untapped possibilities that jQuery makes available, and hone your skills as you return to this guide time and again.

In this book, the creators of the popular jQuery learning resource, learningquery.com, share their knowledge, experience, and enthusiasm to bring you a comprehensive reference to the popular JavaScript library.

Visit the jQuery Reference Guide Free Online Edition and read chapter introductions and a free chapter in full.


This book is a detailed reference guide, and an invaluable resource for answers to all your jQuery questions. It begins with a real-world jQuery example, which illustrates the structure of a jQuery script. A detailed reference chapter is then presented for each of the main components of jQuery. The book concludes with three reference chapters on jQuery plug-ins: the API for plug-in creation, the Dimensions plug-in, and the Form plug-in.

Who this book is for

This book is for web developers who want a broad, organized view of all the jQuery library has to offer or a quick reference on their desks to refer to for particular details.

The reader needs the basics of HTML and CSS, and should be comfortable with the syntax of JavaScript, but no knowledge of jQuery is assumed. This is not an introductory title and if you are looking to get started with jQuery (or JavaScript libraries in general) then you are looking for Learning jQuery.

Buy jQuery Reference Guide


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