Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing jQuery?

Tags:

jquery

What is the procedure for installing jQuery for someone new to it?

like image 842
Hariharbalaji Avatar asked Sep 22 '09 06:09

Hariharbalaji


People also ask

Can you put jQuery in HTML?

It is quite popular among the developers because of its simplicity, compatibility, flexibility, amazing effects, and ease in adding code to the HTML file. jQuery is embedded into the <script> tag of HTML file between the <head> tag and the <title> tag.

Which jQuery should I download?

Downloading jQuery There are two versions of jQuery available for downloading: Production version - this is for your live website because it has been minified and compressed. Development version - this is for testing and development (uncompressed and readable code)

How do I know if jQuery is installed?

You can just type window. jQuery in Console . If it return a function(e,n) ... Then it is confirmed that the jquery is loaded and working successfully.


2 Answers

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.

like image 70
meder omuraliev Avatar answered Sep 19 '22 20:09

meder omuraliev


There is no installation per se.

You download jQuery and include it in your html files like this:

<script src="jquery.js" type="text/javascript"></script> 

Of course, modify the filename so that it's the same as the downloaded script file.

Done!

like image 29
Christian Davén Avatar answered Sep 21 '22 20:09

Christian Davén