jQuery for Absolute Beginners by ed2go instructor Alan Simpson
Okay, so what is jQuery?
If you’re familiar with CSS and HTML but are struggling with jQuery, I feel your pain. It can be difficult to wrap your head around it when you only read bits and pieces about it while doing Web searches.
This is the article you want to read. I’ll talk about the absolute basics—the things that everyone else assumes you already know!
Accessing the Library
One way to provide that access is to download the library yourself and link the page to your copy of the library. But these days, most developers are using CDN (Content Delivery Networks) to host the library. It simplifies things and generally provides better performance.
To link to a jQuery library on a CDN, you put tags like these between the <head> and </head> tags of the page that needs access to the library:
<script src=”http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js” >
That links to version 1.10.2 on Google’s CDN. You’ll find several versions of jQuery at any CDN. Typically, you want to link to the latest one. But if your pages need to support Internet Explorer Versions 6, 7, and 8, be aware that the 2.x versions don’t support those older Internet Explorer versions. Only the 1.x library versions support older Internet Explorer browsers.
Notice that inside the script tag, the URL after src= starts with http:. In other examples, you may not see that in front of the URL. When the page is being served by a Web server from an actual site or a local server on your development machine, then it’s okay to omit the http. But if you’re testing and developing by opening files directly, make sure you use the http: address. Otherwise, jQuery won’t work or it’ll be painfully slow. Read more