At its heart, jQuery does something that sounds pretty dull: it lets you modify the contents of HTML
documents by manipulating the model that the browser creates when it processes the HTML (known as
DOM manipulation, as I’ll explain later). If you are reading this, you have probably already done some
modern web browsers support, and you have picked up this book because you want to do it in a better
jQuery goes beyond better. It makes DOM manipulation a pleasure and, on occasion, an actual joy.
There is something so elegant and graceful about the way that jQuery works that transforms a task that
can be pure drudgery into something that is simple and easy, and once you start using jQuery, there is
no going back. Here are the top reasons that I use jQuery in my projects:
• jQuery is expressive. I can do more work with much less code than when using the
browser DOM API.
• jQuery methods apply to multiple elements. The DOM API approach of selectiterate-
modify is gone, meaning fewer for loops to iterate through elements and
• jQuery deals with implementation differences between browsers. I don’t have to
worry about whether IE supports a feature in an odd way, for example; I just tell
jQuery what I want, and it works around the implementation differences.
• jQuery is open source. When I don’t understand how something works or I don’t
needed, make changes.
Not everything is perfect, of course, and there are one or two rough edges, which I’ll explain as I get
into the details. But even with the occasional flaw, I love working with jQuery, and I hope you will find it
equally compelling and enjoyable to use. To me, the genius of jQuery is that it takes something that is a
major grind in web development and makes it simple, quicker, and easier. I can’t ask for more than that.