Installing jQuery?

Get jQuery up and running in a minute or less:

Insert this into your HTML (most commonly in the head, but you can throw it before the end body tag too):

<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>

Then place a script element after your jQuery one. This would alert ‘hello’ after the DOM is ready.

<script>$(function() { alert('hello') });</script>

Read the documentation.

Using jQuery locally:

After you get a feel, try downloading jQuery locally to your computer, and link it from your script file. The structure is like so:

C:/web/index.html
C:/web/js/jquery.js

index.html:

    <head>
        <script src="js/jquery.js"></script>
        <script>$(function() { alert('hi') })</script>
    </head>

You have the advantage of relying on your saved version offline if you don’t have the Internet/Wi-Fi. You can also make custom edits to the jQuery source and modify it at will.

Study the jQuery source [advanced]

Download the uncompressed version from:

http://code.jquery.com/jquery-latest.js

After you’ve gained a bit of JavaScript/DOM knowledge try to take it apart step by step.

Leave a Comment