By Cody Lindley Publisher: O'Reilly Media Released: November 2009 Pages: 480
jQuery simplifies building rich, interactive web frontends. Getting started with this JavaScript library is easy, but it can take years to fully realize its breadth and depth; this cookbook shortens the learning curve considerably. With these recipes, you'll learn patterns and practices from 19 leading developers who use jQuery for everything from integrating simple components into websites and applications to developing complex, high-performance user interfaces. Ideal for newcomers and JavaScript veterans alike, jQuery Cookbook starts with the basics and then moves to practical use cases with tested solutions to common web development hurdles. You also get recipes on advanced topics, such as methods for applying jQuery to large projects. - Solve problems involving events, effects, dimensions, forms, themes, and user interface elements
- Learn how to enhance your forms, and how to position and reposition elements on a page
- Make the most of jQuery's event management system, including custom events and custom event data
- Create UI elements-such as tabs, accordions, and modals-from scratch
- Optimize your code to eliminate bottlenecks and ensure peak performance
- Learn how to test your jQuery applications
The book's contributors include: - Cody Lindley
- James Padolsey
- Ralph Whitbeck
- Jonathan Sharp
- Michael Geary and Scott González
- Rebecca Murphey
- Remy Sharp
- Ariel Flesler
- Brian Cherne
- Jörn Zaefferer
- Mike Hostetler
- Nathan Smith
- Richard D. Worth
- Maggie Wachs, Scott Jehl, Todd Parker, and Patty Toland
- Rob Burns
|
-
Chapter 1 jQuery Basics -
Introduction -
Including the jQuery Library Code in an HTML Page -
Executing jQuery/JavaScript Coded After the DOM Has Loaded but Before Complete Page Load -
Selecting DOM Elements Using Selectors and the jQuery Function -
Selecting DOM Elements Within a Specified Context -
Filtering a Wrapper Set of DOM Elements -
Finding Descendant Elements Within the Currently Selected Wrapper Set -
Returning to the Prior Selection Before a Destructive Change -
Including the Previous Selection with the Current Selection -
Traversing the DOM Based on Your Current Context to Acquire a New Set of DOM Elements -
Creating, Operating on, and Inserting DOM Elements -
Removing DOM Elements -
Replacing DOM Elements -
Cloning DOM Elements -
Getting, Setting, and Removing DOM Element Attributes -
Getting and Setting HTML Content -
Getting and Setting Text Content -
Using the $ Alias Without Creating Global Conflicts -
Chapter 2 Selecting Elements with jQuery -
Introduction -
Selecting Child Elements Only -
Selecting Specific Siblings -
Selecting Elements by Index Order -
Selecting Elements That Are Currently Animating -
Selecting Elements Based on What They Contain -
Selecting Elements by What They Don’t Match -
Selecting Elements Based on Their Visibility -
Selecting Elements Based on Attributes -
Selecting Form Elements by Type -
Selecting an Element with Specific Characteristics -
Using the Context Parameter -
Creating a Custom Filter Selector -
Chapter 3 Beyond the Basics -
Introduction -
Looping Through a Set of Selected Results -
Reducing the Selection Set to a Specified Item -
Convert a Selected jQuery Object into a Raw DOM Object -
Getting the Index of an Item in a Selection -
Making a Unique Array of Values from an Existing Array -
Performing an Action on a Subset of the Selected Set -
Configuring jQuery Not to Conflict with Other Libraries -
Adding Functionality with Plugins -
Determining the Exact Query That Was Used -
Chapter 4 jQuery Utilities -
Introduction -
Detecting Features with jQuery.support -
Iterating Over Arrays and Objects with jQuery.each -
Filtering Arrays with jQuery.grep -
Iterating and Modifying Array Entries with jQuery.map -
Combining Two Arrays with jQuery.merge -
Filtering Out Duplicate Array Entries with jQuery.unique -
Testing Callback Functions with jQuery.isFunction -
Removing Whitespace from Strings or Form Values with jQuery.trim -
Attaching Objects and Data to DOM with jQuery.data -
Extending Objects with jQuery.extend -
Chapter 5 Faster, Simpler, More Fun -
Introduction -
That’s Not jQuery, It’s JavaScript! -
What’s Wrong with $(this)? -
Removing Redundant Repetition -
Formatting Your jQuery Chains -
Borrowing Code from Other Libraries -
Writing a Custom Iterator -
Toggling an Attribute -
Finding the Bottlenecks -
Caching Your jQuery Objects -
Writing Faster Selectors -
Loading Tables Faster -
Coding Bare-Metal Loops -
Reducing Name Lookups -
Updating the DOM Faster with .innerHTML -
Debugging? Break Those Chains -
Is It a jQuery Bug? -
Tracing into jQuery -
Making Fewer Server Requests -
Writing Unobtrusive JavaScript -
Using jQuery for Progressive Enhancement -
Making Your Pages Accessible -
Chapter 6 Dimensions -
Introduction -
Finding the Dimensions of the Window and Document -
Finding the Dimensions of an Element -
Finding the Offset of an Element -
Scrolling an Element into View -
Determining Whether an Element Is Within the Viewport -
Centering an Element Within the Viewport -
Absolutely Positioning an Element at Its Current Position -
Positioning an Element Relative to Another Element -
Switching Stylesheets Based on Browser Width -
Chapter 7 Effects -
Introduction -
Sliding and Fading Elements in and out of View -
Making Elements Visible by Sliding Them Up -
Creating a Horizontal Accordion -
Simultaneously Sliding and Fading Elements -
Applying Sequential Effects -
Determining Whether Elements Are Currently Being Animated -
Stopping and Resetting Animations -
Using Custom Easing Methods for Effects -
Disabling All Effects -
Using jQuery UI for Advanced Effects -
Chapter 8 Events -
Introduction -
Attaching a Handler to Many Events -
Reusing a Handler Function with Different Data -
Removing a Whole Set of Event Handlers -
Triggering Specific Event Handlers -
Passing Dynamic Data to Event Handlers -
Accessing an Element ASAP (Before document.ready) -
Stopping the Handler Execution Loop -
Getting the Correct Element When Using event.target -
Avoid Multiple hover() Animations in Parallel -
Making Event Handlers Work for Newly Added Elements -
Chapter 9 Advanced Events -
Introduction -
Getting jQuery to Work When Loaded Dynamically -
Speeding Up Global Event Triggering -
Creating Your Own Events -
Letting Event Handlers Provide Needed Data -
Creating Event-Driven Plugins -
Getting Notified When jQuery Methods Are Called -
Using Objects’ Methods as Event Listeners -
Chapter 10 HTML Form Enhancements from Scratch -
Introduction -
Focusing a Text Input on Page Load -
Disabling and Enabling Form Elements -
Selecting Radio Buttons Automatically -
(De)selecting All Checkboxes Using Dedicated Links -
(De)selecting All Checkboxes Using a Single Toggle -
Adding and Removing Select Options -
Autotabbing Based on Character Count -
Displaying Remaining Character Count -
Constraining Text Input to Specific Characters -
Submitting a Form Using Ajax -
Validating Forms -
Chapter 11 HTML Form Enhancements with Plugins -
Introduction -
Validating Forms -
Creating Masked Input Fields -
Autocompleting Text Fields -
Selecting a Range of Values -
Entering a Range-Constrained Value -
Uploading Files in the Background -
Limiting the Length of Text Inputs -
Displaying Labels Above Input Fields -
Growing an Input with Its Content -
Choosing a Date -
Chapter 12 jQuery Plugins -
Introduction -
Where Do You Find jQuery Plugins? -
When Should You Write a jQuery Plugin? -
Writing Your First jQuery Plugin -
Passing Options into Your Plugin -
Using the $ Shortcut in Your Plugin -
Including Private Functions in Your Plugin -
Supporting the Metadata Plugin -
Adding a Static Function to Your Plugin -
Unit Testing Your Plugin with QUnit -
Chapter 13 Interface Components from Scratch -
Introduction -
Creating Custom Tool Tips -
Navigating with a File-Tree Expander -
Expanding an Accordion -
Tabbing Through a Document -
Displaying a Simple Modal Window -
Building Drop-Down Menus -
Cross-Fading Rotating Images -
Sliding Panels -
Chapter 14 User Interfaces with jQuery UI -
Introduction -
Including the Entire jQuery UI Suite -
Including an Individual jQuery UI Plugin or Two -
Initializing a jQuery UI Plugin with Default Options -
Initializing a jQuery UI Plugin with Custom Options -
Creating Your Very Own jQuery UI Plugin Defaults -
Getting and Setting jQuery UI Plugin Options -
Calling jQuery UI Plugin Methods -
Handling jQuery UI Plugin Events -
Destroying a jQuery UI Plugin -
Creating a jQuery UI Music Player -
Chapter 15 jQuery UI Theming -
Introduction -
Styling jQuery UI Widgets with ThemeRoller -
Overriding jQuery UI Layout and Theme Styles -
Applying a Theme to Non-jQuery UI Components -
Referencing Multiple Themes on a Single Page -
Appendix: Additional CSS Resources -
Chapter 16 jQuery, Ajax, Data Formats: HTML, XML, JSON, JSONP -
Introduction -
jQuery and Ajax -
Using Ajax on Your Whole Site -
Using Simple Ajax with User Feedback -
Using Ajax Shortcuts and Data Types -
Using HTML Fragments and jQuery -
Converting XML to DOM -
Creating JSON -
Parsing JSON -
Using jQuery and JSONP -
Chapter 17 Using jQuery in Large Projects -
Introduction -
Using Client-Side Storage -
Saving Application State for a Single Session -
Saving Application State Between Sessions -
Using a JavaScript Template Engine -
Queuing Ajax Requests -
Dealing with Ajax and the Back Button -
Putting JavaScript at the End of a Page -
Chapter 18 Unit Testing -
Introduction -
Automating Unit Testing -
Asserting Results -
Testing Synchronous Callbacks -
Testing Asynchronous Callbacks -
Testing User Actions -
Keeping Tests Atomic -
Grouping Tests -
Selecting Tests to Run -
Colophon |
- Title:
- jQuery Cookbook
- Edited By:
- Cody Lindley
- Publisher:
- O'Reilly Media
- Formats:
-
- Print
- Ebook
- Safari Books Online
- Print:
- November 2009
- Ebook:
- November 2009
- Pages:
- 480
- Print ISBN:
- 978-0-596-15977-1
- | ISBN 10:
- 0-596-15977-3
- Ebook ISBN:
- 978-0-596-80811-2
- | ISBN 10:
- 0-596-80811-9
|
Colophon The animal on the cover of the jQuery Cookbook is an ermine (Mustela erminea), also known as a stoat. "Ermine" sometimes refers to the animal's white winter fur, and "stoat" to the brown fur it has during the rest of the year. It belongs to the weasel family, which includes martens, ferrets, minks, otters, and polecats, though it is distinguished from these other members by its black-tipped tail. The ermine lives in northern woodland regions of Europe, Asia, and North America. It is mainly nocturnal and makes dens in tree roots, under stones, and in tunnels. A solitary animal, the ermine can travel up to 10 miles in one night searching for food. Its predators include foxes, badgers, cats, and birds of prey. The ermine's slender body helps it run swiftly, even across snow, as well as climb and swim. Although this shape has advantages, it also causes the ermine to quickly lose heat from its body. Thick fur and a fast metabolism help compensate, and the ermine must eat daily to meet its energy demands. Its diet includes small mammals, birds, fish, and insects. When the ermine spots its prey, it sneaks up on it in a series of leaps, grasps the victim's neck, and kills it with repeated bites. White ermine fur is highly prized and is used in trimming coats, although demand has dropped in recent years. Typically, several furs are sewn together to form a pattern of black dots on a white field. This pattern was imitated in heraldry-the design of coats of arms-as early as the 12th century, most famously in the arms of Brittany. Ermine fur is also a symbol of royalty or purity, which is perhaps why Elizabeth I of England, "the Virgin Queen," was painted with an ermine by her side. The cover image is from Riverside Natural History. The cover font is Adobe ITC Garamond. The text font is Linotype Birka; the heading font is Adobe Myriad Condensed; and the code font is LucasFont's TheSansMonoCondensed. |
|
Description
|
Table of Contents
|
Product Details
|
Colophon
|
 |
|
 |
|
|
|
Recommended for You
|
 |
|
|
|
Customer Reviews

11/11/2011 (1 of 1 customers found this review helpful) 4.0Great book, but jQuery updates fast. By Tom O from Baltimore, MD About Me Designer, Developer - Helpful examples
- Well-written
- Expert
- Intermediate
- Novice
- Student
10/25/2011 (0 of 1 customers found this review helpful) 1.0Non-Working Code Samples By Karl Groves from Baltimore MD 5/2/2011 (2 of 7 customers found this review helpful) 3/20/2011 (5 of 9 customers found this review helpful) 2.0Source Code is worthless By lockjaw from Oklahoma City, OK About Me Designer, Developer, Educator 8/3/2010 (3 of 3 customers found this review helpful) 5.0Pro. Dev take on the book By Devlin Liles from Springdale, AR - Accurate
- Concise
- Easy to understand
- Helpful examples
- Well Organized
- Well-written
8/1/2010 (1 of 1 customers found this review helpful) By Larry from Somerville, MA - Accurate
- Concise
- Easy to understand
- Helpful examples
- Well-written
- Expert
- Intermediate
- Novice
- Student
6/20/2010 (7 of 10 customers found this review helpful) 4.0where is the source code download? By saub -o -tager from dallas tx 3/10/2010 (4 of 11 customers found this review helpful) - Concise
- Easy to understand
3/8/2010 (5 of 6 customers found this review helpful) 4.0Covers A Lot Of Ground By Chuck Buhecker from Boston, MA - Accurate
- Concise
- Easy to understand
- Helpful examples
- Well-written
- Intermediate
- Novice
- Student
1/11/2010 (6 of 6 customers found this review helpful) 5.0Another Great O'Reilly Cookbook By Adam from Lincoln, NE About Me Designer, Developer - Accurate
- Concise
- Helpful examples
- Well-written
|
|
|
Merchant response: The source code for this book (including code for Ch. 15) is available from the Download Example Code link on this page (http://oreilly.com/catalog/9780596159788 > http://examples.oreilly.com/9780596159788/ ). The direct link to download the files is http://examples.oreilly.com/9780596159788/9780596159771.zip
If you have any questions, please contact customer service by phone at 1.707.827.7000 or 800.998.9938, by email at booktech@oreilly.com, or through our customer service forum http://getsatisfaction.com/oreilly