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?
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 ;)
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.
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.
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"></script>
Place that code within the <head>
tags of your page.
Good luck! :)
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"></script>
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>
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>