26

I need to load the jQuery UI files, and would like to do it from Google. Currently I upload:

<script type="text/javascript" src="http://jqueryui.com/latest/ui/ui.core.js"></script>
<script type="text/javascript" src="http://jqueryui.com/latest/ui/ui.draggable.js"></script>
<script type="text/javascript" src="http://jqueryui.com/latest/ui/ui.droppable.js"></script>

What are the corresponding files I need from Google?

Can I use http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.js?

Also, is there any disadvantage in using this one instead: http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js ?

1

3 Answers 3

35

Yep. It's as simple as that.

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

You could use Google's loader to load it but you don't really need to.

The only real disadvantage to using the min one is that the code is compressed so if you wanted to step through it with a debugger, it would be quite difficult to say the least. The advantages far outweigh this though. In production, I would say by all means use the min one.

Sign up to request clarification or add additional context in comments.

2 Comments

See code.google.com/apis/libraries/devguide.html#jqueryUI for general info on jQuery-ui hosting by google.
I would second @Marcel as the versioning is always going to change
11

The previous answer gives you a link to a specific version of jqueryui but your question implies that you'd like the Google-based links to the latest versions. These are the correct src's:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js"></script>

I see that we're up to version 1.9x at the time of writing. I don't know if the "1" in Google's links will change to a "2" if/when we reach jquery v2. The above links will give you the latest files, anyway, in version 1.

This method doesn't seem to be documented on Google's hosted libraries page, so use with caution. Also the various extra libraries such as draggable / droppable that you've referred to don't seem to be hosted on Google.

See: https://developers.google.com/speed/libraries/devguide?hl=fr#jquery

2 Comments

Note that //code.jquery.com/jquery-latest.min.js will give you a newer version than //ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js (v1.10.0 vs. v1.9.1 at the time of this writing).
Yes, but a newer version of jQuery might break your application. So having this automatically update creates a risk that your application might break at any time. It's better in my opinion to periodically manually update the version to the latest and test, then make the update.
0

you have to paste 2 elements:

<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>

as the developers.google.com site says

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.