Chapter 2. Improving JavaScript with jQuery
In This Chapter
Downloading and including the jQuery library
Using component selectors
Handling events
When building AJAX-enabled Web sites, it can be extremely tedious to write all the JavaScript you need to do even the simplest things. A good way around this is to use a JavaScript library. These are simply JavaScript code fragments with a number of useful functions built in.
Many JavaScript libraries are out there, and none of them write the code for you. What JavaScript libraries do is make complex JavaScript tasks easier to perform. They give you functions to encapsulate complex code into simpler function calls.
JavaScript libraries will vastly increase your productivity and allow you to do a lot more fun and impressive things in much less time. They'll also make it much easier for you to maintain your code because you don't have to rebuild basic functionality. You can concentrate instead on creating a program that solves a particular problem.
Tip
jQuery is a JavaScript library, so to use it, you must be familiar with JavaScript and DOM programming. Check out Book IV if you need a refresher on these topics.
Introducing jQuery
For this minibook, I use the jQuery JavaScript library to enhance JavaScript. jQuery has good documentation, high community involvement, and is easy to use.
Get HTML, XHTML, and CSS All-In-One Desk Reference For Dummies® 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.