Chapter 15. Getting the Most from jQuery

jQuery greatly simplifies JavaScript programming, and lets you quickly and easily give your websites sophisticated interactivity. This book has walked you through some examples, like using jQuery plug-ins for form validation and rollover effects. When you venture into jQuery on your own, you’ll find it isn’t always simple, and you need a certain amount of knowledge to use it to its full extent. In this chapter, you’ll learn how to take jQuery further: how to use the documentation and how to take advantage of prepackaged interactivity with plug-ins, plus some useful tips and tricks.

Useful jQuery Tips and Information

jQuery makes programming easier, but on top of that, there are ways you can make programming jQuery easier. Here are a few bits of information that give you insight into jQuery so you can get the most from it.

$() Is the Same as jQuery()

In the many articles and blog posts on jQuery out there on the Web, you may encounter code like this:

jQuery('p').css('color','#F03');

While you’re familiar with $(‘p’), which selects all the <p> tags on a page, you may be wondering about this jQuery() function. Actually, they are one and the same. The code above could also be written like this:

$('p').css('color','#F03');

$() is an alias for jQuery(), and the two are interchangeable. John Resig, the creator of jQuery, realized that programmers would be using the main jQuery function a lot, so rather than force people to type jQuery() over and over, he ...

Get JavaScript & jQuery: The Missing Manual, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.