jQuery: Novice to Ninja
If you think you've spotted an error or typo in your copy of jQuery: Novice to Ninja check to see if it's listed below. If not, pat yourself on the back! Tell us about it so we can list it here for future readers.
Corrections and Typos
December 2010 update
- p.21 2nd para This paragraph states "you can see that the div that contains our celebrity table has an id of celebs, while the table itself has a class of data." This is incorrect, and should read: "you can see that the table that contains our celebrity data has an id of celebs and a class of data."
- p.94 code block In the code example on this page, the click handler function is passed a parameter e, however this type of parameter isn't explained until page 133. Since it's not actually used in the function, it can safely be omitted.
- p.237 code block
The comma after
required: truein thenameliteral will cause an error in IE7 and should be removed. - p,338 final code block
The jQuery.extend() method will modify the target object; in this case that means the plugin's defaults will be modified permanently. Instead of the provided code, the following should be used:
By targeting an empty object, the defaults remain intact.options = $.extend({}, $.fn.highlightOnce.defaults, options);
April 2010 update
- p.48 last paragraph
The paragraph refers to the
previousfunction. This is incorrect, the jQuery function referred to is calledprev. - p.52 1st code block
The animate() method should in jQuery core should only be used with numeric values (though animation of color values with a suitable plugin or jQuery UI is covered in the next section).
While some browsers will handle this example correctly, others will experience problems. A better illustration of the animate() method would be:
$('p').animate({ padding: '20px', fontSize: '30px' }, 2000); - p.210 1st code block
attr('src', 'images/' + data)should readattr('src', 'images/' + image_url)as image_url is the parameter passed to that function.
1st edition, February 2010
- p.12 callout The callout says to check Appendix A for information on dealing with multiple libraries. In fact, that information is in Chapter 9, on page 362.
- p.39 last paragraph "As you can see in Figure 2.6, our new elements have been added to the start and end of the actual disclaimer div," should say paragraph rather than div.
- p.48 1st code block
The code block shows the insertion of a
spanelement, but the text refers to a button, and Figure 2.7 shows the modified DOM as containing a button rather than a span. For consistency, the 2nd line in the code block should be:$('<input type="button" class="revealer" value="Tell Me!"/>') - p.53 The color animations plugin is no longer under active development, however color animation functionality is available in the "Effects Core" package of the jQuery UI library. It's recommended to use that instead. Information on downloading and using jQuery UI can be found on page 69 of the book.
- p.56 bullet points The two last bullet points mention 300 pixels, but the code block on the previous page uses values of 150 pixels.
- p.66 code block
The line:
should be{left: $('navigation li:first a').position().left; }
(without the semi-colon){left: $('navigation li:first a').position().left } - p.69 code block The selector '#nav_stretch li' should be '#navigation li'.
- p.80 There is a bug in jQuery 1.4 where loading a new stylesheet will not apply the styles in Internet Explorer (works in other browsers). For this example the sample code is using jQuery 1.3.2. This is likely to be resolved in an upcoming jQuery release, but if you need this functionality right now you should use jQuery 1.3.2.
- p.85 2nd para
The example in the last sentence,
{ handles : 'n', 'se' }, should instead be:{ handles : 'n, se' }(with one string containing the comma, not two strings). - p.93-94 lightbox.css code block
The ID and class names here are inconsistent with the ones in the JavaScript listing. Instead of
#lightbox_overlayand#lightbox_containerthey should be#overlayand#lightbox. - p.95 tip
In the code block in the "quick element construction" tip,
clickshould not be preceded by a period. - p.113 2nd code block
The cross-fade slideshow example shows the first image only for a split second before the slide show begins.
The first image to be faded in the sequence needs to better reflect the DOM structure; the number to feed into the first call of the method is 3, as the image which is showing on ready is 4 in the zero index. Starting with 3 means that as soon as the method loads it shows image 4 for four seconds and fades on from there.
The script should read:
$(document).ready(function() { rotatePics(3); }); - p.120-129 1st code block
The element IDs in the markup shown do not correspond to those in the CSS and script files. Use
photosandphotos_innerthroughout or refer to the code archive. This has been corrected both in the code archive and in the web PDF. - p.122 code block
On the line marked with a 6, the variable
currentScrollPosis used, which has not been defined. The variable that should be used iscurrentPos. - p.124 1st code block
The element IDs in the markup shown do not correspond to those in the CSS and script files. Use
pic_containerandpic_scrollerthroughout or refer to the code archive. Also, the width and height values in the CSS should be as follows:#pic_container { overflow: hidden; height: 200px; width: 200px; margin-bottom: 15px; } #pic_scroller { height: 600px; width: 800px; overflow: hidden; } - p.166 last paragraph "which will look for an overlay without the class class" should say "which will look for an overlay without the active class"
- p.186 2nd code block The boolean, pi, and css properties are incorrectly assigned using an equals sign (=) rather than a colon (:). This will result in a syntax error, all properties in an object literal declaration should be included with :, as is done for the namespaces, setup, and exclaim properties.
- p.203 code block The line immediately after the comment ends with a semi-colon. That should not be there, there should only be a closing curly bracket on that line.
- p.248 code sample There is a bug in jQuery 1.4 which prevents this code from working. If you use jQuery 1.4.2 it will function as intended.
- p.365 2nd code block The comment that reads "this animation won't fire" should actually read "this animation WILL fire".
Satisfaction Guaranteed at SitePoint
Of course, we’re so confident that you’ll be satisfied with this book for years to come that we’re happy, as always, for you to try it risk-free for 30 days. If you purchase a copy of jQuery: Novice to Ninja and you think it falls short of being everything you wanted, we’d like you to have your money back.
Simply contact us and we’ll see to it that you receive a prompt refund of the full purchase price, minus shipping and handling.
What could be fairer than this?
More Information
Customer Reviews
Live, unmoderated reviews from our customers, typos and all.
This book is clear and straight forward with invaluable tips and best practices.
Highly recommended.
Ron G., USA 
A very practical guide for jQuery, clearly explained for are levels
dan trujillo, USA 
Great read! I love learning about JQuery and really feel like I have a better understanding of how it works and some cool effects. Highly recommend all the books from Sitepoint!
Kevin Kendle, USA 
Well I am still a novice for now. This book is making jQuery much more understandable and I look forward to applying it in my development work.
Curtis C James, USA 
The book came in good condition and I was very happy for recieving a bonus e-book for the delay. I will definatelly come back to shop from you.
many regards
claudio
Claudio Faro, USA 
See More Reviews or Write Your Own
Sample Download
We think this is a brilliant book, but judge for yourself. Grab the first few chapters and start learning jQuery today without spending a cent.
