views:

82

answers:

6

I'm trying to download JQuery. When I click the minified version, I just get a bunch of code displayed in the browser. I don't actually download anything. What am I supposed to do? How do I download JQuery and do I need to put it where my other files are?

+6  A: 

Right click or command click the link and select "Save As.."

Or just copy the minified code displayed in the browser and save it to your JavaScript file.

Maybe I am over simplifying it... it's late ;)

Jason McCreary
+1 Wow, I didn't know the checkbox pointed to the script file. I was right-clicking the download button instead -facepalm-
BoltClock
You actually cant do "Save As" in chrome...
Trufa
@Trufa It's called "Save Link as..." in Chrome and it works. Only you need to click on the checkbox, which is the actual link, not the download button.
deceze
@deceze you could not be more right!! thanks so much I would have never figured it out!! I will add it to my answer if you don´t mind, for completeness sake... Thanks
Trufa
+1  A: 

For some reason jQuery's site doesn't initiate a browser download of jQuery for you. Once you reach the page containing the code, simply save the current page as a .js file onto your computer. Don't worry, it is the actual minified jQuery script that you're looking to download.

BoltClock
I prefer scripts appearing in my browser :)
alex
@alex: Well, yeah, since file download transfers can be malicious and all. Depends on how they're served :)
BoltClock
+5  A: 

Goto this page : http://docs.jquery.com/Downloading_jQuery

Right Click the download link and click "Save Link As" (FF) or "Save Target as" (IE) and save it in your preferred location.

Shoban
+5  A: 

You can also link to the following jQuery source from Google's server, I believe the term is Google CDN.

This is handy if a user or visitor of your site has that file already cached, which there is a good chance it is, loading times will be increased! :)

You could use the following code:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"&gt;&lt;/script&gt;

Place that code within the <head> tags of your page.

Good luck! :)

BOSS
+1 Beat me to it ;-)
Cameron
Haha, I'll vote yours up just cuz, and it still answers the question.
BOSS
+5  A: 

There are many ways you can get this to work

(it is supposed to show you the code like that)

You can copy all the code and save it as and jquery.js file and the call it like this:

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

Or you could just call it like this:

<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"&gt;&lt;/script&gt;

You can also link to it from many different places:

http://code.jquery.com/jquery-1.4.2.js Source version

Google Ajax API CDN

http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js

Microsoft CDN

http://ajax.microsoft.com/ajax/jquery/jquery-1.4.2.min.js

Read more here:

http://docs.jquery.com/Downloading_jQuery

EDIT:

If you want to download the code you can actually do it! right-click the checkbox for example: PRODUCTION (24KB, Minified and Gzipped) and choose save as (maybe you´ll need to add the .js extension) "Thanks to: Jason McCreary & deceze"

EDIT:

To clarify your comment, you should include the jQuery like this:

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

and now work as usual:

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

or

<script language="javascript" type="text/javascript">

your javascript here

</script>
Trufa
i like being able to link to it w/o having to download it and save it... then where do I write the javascript code? and how do I link to that code?
Justin Meltzer
@Justin Meltzer If you need any clarifications please ask!
Trufa
@justin: the better way is you have your own downloadable folder from jquery instead directly linked to that site. bcoz it wasting time for loading some file if you have your own development bundle you can load faster.
klox
ok, but then where do I write the javascript code? Usually you link to your javascript page but now i'm linking to the jquery framework instead. so where do I put the javascript code?
Justin Meltzer
@Justin I will make an edit to clarify!
Trufa
@Justin You should probably start with a tutorial: http://docs.jquery.com/Tutorials:Getting_Started_with_jQuery
deceze
+1  A: 

To answer the second part of your question, you can put the jQuery source file anywhere you want, as long as it's accessible via a URL.

To include jQuery in your webpages, add the following code to the <head> of your HTML:

<script src="http://www.example.com/path/to/jquery.js" type="text/javascript"></script>

You can also use Google's CDN, which hosts jQuery for all to use (free), for better performance:

<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/jquery-ui.min.js" type="text/javascript"></script>
Cameron