Author: Earl Castledine
Publisher: Sitepoint, 2010
Pros: Good coverage of UI aspects
Cons: Not so good on core JQuery
Reviewed by: Ian Elliot
What you think of this book very much depends on what you think JQuery is for and what you want to do with it.
Personally I think JQuery is all about navigating and editing the DOM. It's about Ajax and building dynamic web pages that do in things that would be difficult to do from the server side. Only as an after thought is it about creating an enhanced user interface. JQuery is even split into two parts - JQuery core and the UI component to emphasize this split in use and purpose.
If your main concern is to find out how to use JQuery's selectors, traversal methods and editing methods then this book might not please. These topics are covered but they are not the main issue and many times in the book the subject is glossed over with a "you can work this out for yourself if you know about CSS and selectors". This is reasonable but of course even if you do know about CSS and selectors exactly how to translate this knowledge into a good JQuery expression can be less than obvious.
The book starts off with an introduction to JQuery which basically says that its the best thing ever. Then we move on to the basics of selection and manipulating the DOM. This is where the book gets a little lost and if you are a novice you might well end up wondering what JQuery is all about. For example, one suggested task is changing the style of an object. This is done successfully and then the issue of the fact that an inline style is used for this is raised - what issue? Inline styles aren't a problem unless the HTML is going to be further developed and this isn't because it is generated by JQuery. We then have a strange exercise where the style is moved to the style sheet and a class is applied to the object. Yes this is the correct way to do things if you have access to and are allowed to change the style sheet. But it is misleading in that it gives the impression that JQuery can somehow be used to create permanent changes to the style and HTML when it is really all about dynamic changes. What the chapter could have said better is that you should plan for what you are doing in JQuery by creating styles in the style sheet that JQuery instructions can use or, if you want to make temporary changes that don't modify the style sheet or the HTML, then by all means go ahead and don't worry that the style is inline. Given that even when expressed in full this isn't an easy idea it would have probably best been left until later.
From this basic start on the JQuery core Chapter Three moves on to the UI with animating, scrolling and resizing. Then Images and Resizing and Chapter Five describes menus, tabs, tooltips and panels. Chapter Six moves on to consider Ajax, but again with a very UI-oriented approach. Chapters Seven and Eight again return to the UI with Forms, Controls and Dialogs and Lists, Trees and Tables. Finally we have a brief look at plugins and themes .
The explanations and discussions are mostly clear and the examples are mostly appropriate and of the right size. Most of the narrative is motivated by a discussion of how to satisfy the demands of an imaginary client and while this sometimes gets it the way it mostly works. At the start of Chapter Three, though, there is a request that more or less puts the book into context:
"I think it needs some of that Web 2.0 that I've been hearing about" he says confidently. "Can you make it look more like a Web 2.0?"
Notice the use of "look". If you think that the problem of Web 2.0 is making things behave like Web 2.0, i.e. creating a web application that uses the DOM and Ajax to DO something cool, then you might not get as much from this book as you would expect. If on the other hand you have your app's behavior sorted out then you might manage to make it look like a Web 2.0 using the techniques described.
Overall this is a good book as long as you take its title to be "JQuery and the UI" and this is what you want to concentrate on.