Lastly, many events you might want the page to respond to, often had to be called separately. I recall sometimes having to create an event script for Firefox (or way, way back in time, on Netscape) and a separate event script for IE. Occasionally, I'd even devise little creative ways to detect different browsers or "trick" them into responding to different events that on the whole were just to make the page appear to look and respond somewhat similarly between the two browsers.
One of the first things that I grew to love about jQuery (other than its excellent, clear documentation) is that it is essentially a fantastic "loop engine". Now, I call it "looping", but those of you with a more formal programming background or some previous experience with jQuery have probably heard the term used as: implicit iteration. Essentially, jQuery iterates, that is, repeats (aka: loops) through the selected elements of its container object without the introduction of an explicit iterator object, hence, using the term implicit. OK, complicated definitions aside, it simply means you can do just about anything you need to a set of elements, without ever having to write a foreach or while loop! Most people I chat with about jQuery, have no idea this is what jQuery is really doing under the hood.
What's even cooler than being able to easily loop through selected elements is the ability to select them in the first place using standard CSS notation. Then, as if those two features weren't wonderful enough, once you've grabbed a set of elements, if you have more than one operation that you want to apply to the selected set of elements, no problem! Rather than evoking individual functions and scripts on the selection over and over, you can perform multiple operations all at once, in a single line of code. This is called statement chaining. Statement chaining is awesome and we'll learn all about it and take advantage of it often throughout this title.
Lastly, jQuery is extremely flexible and most importantly, extensible. In the four years it's been around, there have been thousands of third-party plugins written for it. It's also very easy to write your own jQuery plugins as we'll discover in this book. However, you'll probably find that for most of your more practical day-to-day WordPress development and maintenance needs, you won't have to! Just as WordPress saves you loads of time and work, you'll find with jQuery that a lot of the work has already been done as well.
Whatever you wish to create, you can probably find a way to do it fairly easily with a jQuery plugin and a tweak or two to your WordPress theme. Perhaps you might just need to write a quick and simple jQuery script to enhance one of your favorite WordPress plugins. We'll go over the basics of jQuery and the most common uses of applying it to WordPress in this book and you'll quickly see that the possibilities are endless.
This book is here to help you create solutions for scenarios and problems that tend to confront WordPress users. I'm hoping to help you save a little time having to poke through WordPress' wonderful yet extensive codex and jQuery's API documentation. But by no means will this book replace those resources or the great resources maintained by jQuery and WordPress' community members.
For jQuery, I highly recommend you check out jQuery's documentation and the Learning jQuery site:
Was this article helpful?