Tag Archives: alan simpson

jQuery for Absolute Beginners by ed2go Instructor Alan Simpson


jQuery for Absolute Beginners by ed2go instructor Alan Simpson

Okay, so what is jQuery?

jQuery is an immensely popular “write less, do more” library of JavaScript code for Web developers. We use it in conjunction with HTML and CSS in Web development, primarily to add more interactivity or animation to a page.

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

Unlike JavaScript code, which all Web browsers can execute on their own, jQuery is a library of prewritten code that’s not built into the Web browser. You can only use jQuery in pages that have access to the jQuery 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