Book Image

jQuery Reference Guide

By : Jonathan Chaffer, Karl Swedberg
Book Image

jQuery Reference Guide

By: Jonathan Chaffer, Karl Swedberg

Overview of this book

<p>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.<br /><br />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.<br /><br />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.<br /><br />This book is a companion to <a href="http://www.packtpub.com/jQuery/book">Learning jQuery</a>: Better Interaction Design and Web Development with Simple JavaScript Techniques. <br /><a href="http://www.packtpub.com/jQuery/book">Learning jQuery</a> 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.<br /><br />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.</p>
Table of Contents (19 chapters)
jQuery Reference Guide
Credits
About the Authors
About the Reviewers
Preface
Index

XPath Selectors


Modeled after a file system's directory-tree navigation, XPath selector expressions provide an alternative way to access DOM elements. Although XPath was developed as a selector language for XML documents, jQuery makes a basic subset of its selectors available for use in XML and HTML documents alike.

For more information about XPath 1.0, visit the specification at the W3C: http://www.w3.org/TR/xpath.

Descendant: E//F

All elements matched by F that are descendants of an element matched by E.

Examples

  1. $('div//code'): selects all elements matched by <code> that are descendants of an element matched by <div>

  2. $('//p//a'): selects all elements matched by <a> that are descendants of an element matched by <p>

Description

This XPath descendant selector works the same as the corresponding CSS descendant selector ($('E F')) except that the XPath version can specify that it is to start at the document root, which could be useful when querying an XML document.

In example...