— loads jQuery library
jQuery and using libraries
This set of code is called a library. Code libraries can share a set of useful programming functions to more than one program. I have made dozens of code libraries in the past to support large or repetitive projects. For example, if I am constantly validating user security among a couple hundred web pages, I will write one shared library that will help apply security consistently and with less effort. Writing one library to use with many programs means less work and less repetition.
jQuery is a set of libraries developed by Google to help make and run Google web apps. The home of the jQuery community is at: jquery.com.
jQuery's libraries allow you to do things like:
- animate things easily and simply
- handle input events a little more gracefully
- handle reading data from outside sources
- handle making webpages work well on different devices
- and more
In this lesson, we will be using jQuery to simplify animation.
Linking the jQuery library to your code
In the head of your document, you can add the jQuery library by adding this before your
Every time your page is loaded, it will now contact a google webserver, and download the library so that your browser can use it.
This slows down the load speed of your page a little.
Some people download their own copy of the library and point the
<script src="..."> to their downloaded copy.
Sometimes this actually slows things down more — it all depends on internet traffic and server power.