Selecting form elements by type.............................................................................................. 67 Selecting all form elements...................................................................................................... 67
Chapter 6 Events................................................................................................................... 69 Not limited to a single ready() event...................................................................................... 69 Attaching / removing events using bind() and unbind()........................................................ 69 Programmatically invoke a specific handler via short event methods..................................... 71 jQuery normalizes the event object......................................................................................... 71 Event object attributes............................................................................................................................. 72 Event object methods.............................................................................................................................. 72 Grokking event namespacing.................................................................................................. 72 Grokking event delegation....................................................................................................... 74 Applying event handlers to DOM elements regardless of DOM updates using live().......... 75 Adding a function to several event handlers............................................................................ 76 Cancel default browser behavior with preventDefault()..................................................... 77 Cancel event propagation with stopPropagation().............................................................. 77 Cancelling default behavior and event propagation via return false.................................. 78 Create custom events and trigger them via trigger().......................................................... 79 Cloning events as well as DOM elements............................................................................... 79 Getting X and Y coordinates of the mouse in the viewport...................................................... 80 Getting X and Y coordinates of the mouse relative to another element.................................. 80
Chapter 7 jQuery and the Web Browser............................................................................. 82 Disabling the right-click contextual menu................................................................................ 82 Scrolling the browser window.................................................................................................. 82
Chapter 8 Plugins................................................................................................................. 84 Use the $ alias when constructing a plugin............................................................................. 84 New plugins attach to jQuery. fn object to become jQuery methods..................................... 84 Inside a plugin, this is a reference to the current jQuery object............................................ 85 Using each() to iterate over the jQuery object and provide a reference to each element in the object using the this keyword................................................................................................ 86 Plugin returning jQuery object so jQuery methods or other plugins can be chained after using plugin....................................................................................................................................... 87 Default plugin options.............................................................................................................. 88 Custom plugin options............................................................................................................. 88 Overwriting default options without altering original plugin code............................................. 89 Create elements on the fly, invoke plugins programmatically.................................................. 90 Providing callbacks and passing context................................................................................. 91
Chapter 9 Effects.................................................................................................................. 93
6