Bear Bibeault, Yehuda Katz, John Resig9781933988351, 1-933988-35-5
jQuery in Action , like jQuery itself, is a concise tool designed to make you a more efficient and effective web developer. In a short 300 pages, this book introduces you to the jQuery programming model and guides you through the major features and techniques you’ll need to be productive immediately. The book anchors each new concept in the tasks you’ll tackle in day-to-day web development and offers unique lab pages where you immediately put your jQuery knowledge to work.
There are dozens of JavaScript libraries available now, with major companies like Google, Yahoo and AOL open-sourcing their in-house tools. This book shows you how jQuery stacks up against other libraries and helps you navigate interaction with other tools and frameworks.
jQuery in Action offers a rich investigation of the up-and-coming jQuery library for client-side JavaScript. This book covers all major features and capabilities in a manner focused on getting the reader up and running with jQuery from the very first sections. Web Developers reading this book will gain a deep understanding of how to use jQuery to simplify their pages and lives, as well as learn the philosophy behind writing jQuery-enhanced pages.
Table of contents :
jQuery in Action……Page 1
foreword……Page 12
preface……Page 14
acknowledgments……Page 17
Yehuda Katz……Page 18
about this book……Page 20
Roadmap……Page 21
Code downloads……Page 23
Author Online……Page 24
about the authors……Page 25
about the title……Page 27
about the cover illustration……Page 28
Introducing jQuery……Page 30
1.1 Why jQuery?……Page 31
1.2 Unobtrusive JavaScript……Page 32
1.3 jQuery fundamentals……Page 34
1.3.1 The jQuery wrapper……Page 35
1.3.2 Utility functions……Page 37
1.3.3 The document ready handler……Page 38
1.3.4 Making DOM elements……Page 40
1.3.5 Extending jQuery……Page 41
1.4 Summary……Page 43
Creating the wrapped element set……Page 45
2.1 Selecting elements for manipulation……Page 46
2.1.1 Using basic CSS selectors……Page 48
2.1.2 Using child, container, and attribute selectors……Page 49
2.1.3 Selecting by position……Page 53
2.1.4 Using custom jQuery selectors……Page 56
2.2 Generating new HTML……Page 60
2.3 Managing the wrapped element set……Page 61
2.3.2 Obtaining elements from the wrapped set……Page 63
2.3.3 Slicing and dicing the wrapped element set……Page 65
2.3.4 Getting wrapped sets using relationships……Page 72
2.3.5 Even more ways to use a wrapped set……Page 73
2.3.6 Managing jQuery chains……Page 74
2.4 Summary……Page 76
Bringing pages to life with jQuery……Page 77
3.1 Manipulating element properties and attributes……Page 78
3.1.1 Manipulating element properties……Page 80
3.1.2 Fetching attribute values……Page 81
3.1.3 Setting attribute values……Page 83
3.1.5 Fun with attributes……Page 85
3.2.1 Adding and removing class names……Page 87
3.2.2 Getting and setting styles……Page 90
3.2.3 More useful style-related commands……Page 96
3.3.1 Replacing HTML or text content……Page 97
3.3.2 Moving and copying elements……Page 99
3.3.3 Wrapping elements……Page 104
3.3.4 Removing elements……Page 105
3.3.5 Cloning elements……Page 107
3.4 Dealing with form element values……Page 108
3.5 Summary……Page 110
Events are where it happens!……Page 111
4.1 Understanding the browser event models……Page 113
4.1.1 The DOM Level 0 Event Model……Page 114
4.1.2 The DOM Level 2 Event Model……Page 120
4.1.3 The Internet Explorer Event Model……Page 126
4.2.1 Binding event handlers using jQuery……Page 127
4.2.2 Removing event handlers……Page 132
4.2.3 Inspecting the Event instance……Page 133
4.2.5 Triggering event handlers……Page 135
4.2.6 Other event-related commands……Page 136
4.3 Putting events (and more) to work……Page 141
4.4 Summary……Page 153
Sprucing up with animations and effects……Page 155
5.1 Showing and hiding elements……Page 156
5.1.1 Implementing a collapsible list……Page 157
5.1.2 Toggling the display state of elements……Page 163
5.2.1 Showing and hiding elements gradually……Page 164
5.2.2 Fading elements into and out of existence……Page 169
5.2.3 Sliding elements up and down……Page 172
5.3 Creating custom animations……Page 174
5.3.2 A custom drop animation……Page 177
5.3.3 A custom puff animation……Page 179
5.4 Summary……Page 181
jQuery utility functions……Page 182
6.1 Using the jQuery flags……Page 183
6.1.1 Detecting the user agent……Page 184
6.1.2 Determining the box model……Page 190
6.2 Using other libraries with jQuery……Page 192
6.3 Manipulating JavaScript objects and collections……Page 196
6.3.1 Trimming strings……Page 197
6.3.2 Iterating through properties and collections……Page 198
6.3.3 Filtering arrays……Page 199
6.3.4 Translating arrays……Page 201
6.3.5 More fun with JavaScript arrays……Page 204
6.3.6 Extending objects……Page 205
6.4 Dynamically loading scripts……Page 209
6.5 Summary……Page 213
Extending jQuery with custom plugins……Page 214
7.1 Why extend?……Page 215
7.2.1 Naming files and functions……Page 216
7.2.2 Beware the $……Page 218
7.2.3 Taming complex parameter lists……Page 219
7.3 Writing custom utility functions……Page 221
7.3.1 Creating a data manipulation utility function……Page 222
7.3.2 Writing a date formatter……Page 224
7.4 Adding new wrapper methods……Page 228
7.4.1 Applying multiple operations in a wrapper method……Page 230
7.4.2 Retaining state within a wrapper method……Page 235
7.5 Summary……Page 245
Talk to the server with Ajax……Page 246
8.1 Brushing up on Ajax……Page 247
8.1.1 Creating an XHR instance……Page 248
8.1.2 Initiating the request……Page 250
8.1.3 Keeping track of progress……Page 251
8.1.4 Getting the response……Page 252
8.2 Loading content into elements……Page 253
8.2.1 Loading content with jQuery……Page 255
8.2.2 Loading dynamic inventory data……Page 258
8.3 Making GET and POST requests……Page 262
8.3.1 Getting data with jQuery……Page 263
8.3.2 Getting JSON data……Page 265
8.3.3 Making POST requests……Page 277
8.4.1 Making Ajax requests with all the trimmings……Page 278
8.4.2 Setting request defaults……Page 281
8.4.3 Global functions……Page 282
8.5 Putting it all together……Page 287
8.5.1 Implementing the flyout behavior……Page 288
8.5.2 Using The Termifier……Page 291
8.5.3 Room for improvement……Page 293
8.6 Summary……Page 295
Prominent, powerful, and practical plugins……Page 297
9.1 The Form Plugin……Page 298
9.1.1 Getting form control values……Page 299
9.1.2 Clearing and resetting form controls……Page 303
9.1.3 Submitting forms through Ajax……Page 305
9.1.4 Uploading files……Page 313
9.2.1 Extended width and height methods……Page 314
9.2.2 Getting scroll dimensions……Page 316
9.2.3 Of offsets and positions……Page 318
9.3.1 Establishing proactive event handlers……Page 321
9.3.3 Forcing Live Query evaluation……Page 323
9.3.4 Expiring Live Query listeners……Page 324
9.4 Introduction to the UI Plugin……Page 328
9.4.1 Mouse interactions……Page 329
9.5 Summary……Page 345
9.6 The end?……Page 346
appendix: JavaScript that you need to know but might not!……Page 348
A.1.1 How objects come to be……Page 349
A.1.2 Properties of objects……Page 350
A.1.3 Object literals……Page 353
A.1.4 Objects as window properties……Page 354
A.2 Functions as first-class citizens……Page 355
A.2.1 What’s in a name?……Page 356
A.2.2 Functions as callbacks……Page 358
A.2.3 What’s this all about?……Page 359
A.2.4 Closures……Page 363
A.3 Summary……Page 366
A……Page 368
D……Page 369
E……Page 370
I……Page 371
J……Page 372
O……Page 373
S……Page 374
W……Page 375
Z……Page 376
Reviews
There are no reviews yet.