Sams Teach Yourself HTML, CSS & JavaScript Web Publishing in One Hour a Day

(singke) #1
ptg16476052

Your First jQuery Script 501

18


jQuery is a regular JavaScript file that you can include in your page using the

The file you download will have a different name than jquery.js
because it will include the jQuery version number. You’ll have to
rename it as jquery.js or use the full filename in your <script>
tag. You can download jQuery in production or development
configurations. The production configuration is “minified”—
compressed so that it downloads as quickly as possible.
Unfortunately, the minified file is unreadable by humans; so if you
think you may need to look at the jQuery source, download the
development version. Just be sure to replace it with the minified
version when you make your site live.

NOTE

Your First jQuery Script


jQuery is built around the idea of selecting objects on the page and then performing
actions on them. In some ways, it’s very similar to CSS. You use a selector to define an
element or set of elements, and then you write some code that is applied to those ele-
ments. Here’s an example of a page that includes a simple jQuery script:


<!DOCTYPE html>




jQuery Example


A link



Free download pdf