02.06.2013 Views

JavaScript & jQuery: The Missing Manual ... - Robert Guajardo

JavaScript & jQuery: The Missing Manual ... - Robert Guajardo

JavaScript & jQuery: The Missing Manual ... - Robert Guajardo

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Adding <strong>jQuery</strong> to a<br />

Page<br />

I see that this book uses version 1.6.3 of <strong>jQuery</strong>, but the<br />

current version on the <strong>jQuery</strong> site is 1.X. Is this a problem?<br />

<strong>jQuery</strong> is always evolving. New bugs are often discovered,<br />

and the <strong>jQuery</strong> team works diligently to fix them. In addition,<br />

as new web browsers come out with new capabilities<br />

and better support for current standards, the <strong>jQuery</strong> team<br />

updates <strong>jQuery</strong> to work most efficiently with those browsers.<br />

Finally, new features are sometimes added to <strong>jQuery</strong> to<br />

make it more useful for web programmers. For these reasons,<br />

it’s likely that you can find a newer version of <strong>jQuery</strong><br />

than the one that’s used in this book. If there is a newer<br />

version, then by all means use it.<br />

<strong>jQuery</strong> has matured over the years and its core functionality<br />

changes very little. While the <strong>jQuery</strong> programmers<br />

are often tinkering under the hood to make <strong>jQuery</strong> faster,<br />

work better across browsers, and fix bugs, the way you<br />

use <strong>jQuery</strong> doesn’t usually change that much. In other<br />

words, while programmers might alter a <strong>jQuery</strong> function<br />

to perform better, the way you use that function—the function<br />

name, the arguments you give it, and the values it returns—don’t<br />

often change. This means that what you learn<br />

in this book will most probably work with a newer version<br />

of <strong>jQuery</strong>, but only faster and better.<br />

You can often tell how much different one version of<br />

<strong>jQuery</strong> is from another by the numbering scheme. <strong>The</strong> first<br />

number points to a very significant new version. Currently<br />

FREQUENTLY ASKED QUESTION<br />

<strong>jQuery</strong> Versions<br />

Adding <strong>jQuery</strong> to a Page<br />

122 javascript & jquery: the missing manual<br />

<strong>jQuery</strong> is in version 1, so we’ve seen version 1, 1.2, 1.3, 1.4,<br />

and so on. Version 2 (which probably won’t arrive for quite<br />

some time) will undoubtedly offer some significant new<br />

capabilities. <strong>The</strong>n there are the dot releases like the .6 in<br />

<strong>jQuery</strong> 1.6. Each of those numbers usually offers new functions,<br />

rewriting of older functions to work better, and so<br />

on. Finally, the last number, like the final 3 in <strong>jQuery</strong> 1.6.3,<br />

usually refers to some sort of bug fix for the 1.6 branch of<br />

<strong>jQuery</strong>. So if you’re using version 1.6.3 of <strong>jQuery</strong> and version<br />

1.6.8 comes out, it’s usually a good idea to upgrade, as<br />

this will probably include fixes from problems discovered<br />

in 1.6.3.<br />

To find out what’s changed in a new version, just visit the<br />

“Current release” section of the Downloads page at http://<br />

docs.jquery.com/Downloading_<strong>jQuery</strong>#Current_Release.<br />

<strong>The</strong>re you’ll find a link to “Release notes.” Click that link<br />

to visit a page listing changes made to that version. After<br />

reading the list of changes, you can decide for yourself if it<br />

seems worthwhile to upgrade (for example, if the changes<br />

relate to features you don’t use on your site, you can probably<br />

skip this upgrade; however, if the changes are bug<br />

fixes related to features you do use, it’s a good idea to upgrade.<br />

(If you use <strong>jQuery</strong> plug-ins on your site, you’ll need<br />

to be a bit more cautious about upgrading to the latest<br />

version of <strong>jQuery</strong>, unless you’re sure the plug-in works with<br />

the new version of <strong>jQuery</strong>.)<br />

If you’re using one of the CDN versions of <strong>jQuery</strong> (page 120), you can point to it using<br />

one of the code snippets listed on page 120. For example, to use the Google CDN<br />

version of <strong>jQuery</strong>, you’d add tags to the head of the page like this:<br />

<br />

www.it-ebooks.info

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!