Reputation: 3803
I am trying to learn Jquery but getting a little confused by the different Jquery versions. Can someone explain if Jquery is a single library or a set of libraries/references? I will try to make an analogy with C#.
Suppose I want to use XML functions I will write
Using System.XML;
Suppose I want to use Linq function I will write
Using System.Linq;
I checked the Jquery Website Link why do we have to use two reference links and css links to use any function?
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css"/>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css" />
Also why in so many examples the same Jquery version is used with a .min suffix?
Upvotes: 1
Views: 125
Reputation: 3168
jQuery is a single library named:
jquery<version>.js
eg. jquery-1.10.1.min.js
But there are many extensions to it. You even can create your own plugin for jQuery and based on what feature you want to use you can use the plugin. You can find all the basic plugins here :
http://plugins.jquery.com/
But to make plugins work, you always need the core jquery file.
Upvotes: 1
Reputation: 15656
This is jQuery:
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
This is jQuery UI, it's other library containing widgets like datepicker etc.
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
This is CSS file for jQuery-UI library.
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css"/>
Because jQuery UI gives you widgets that you show on your page, it is needed to give it some look. This is why you need CSS file. You can choose different css theme file, to give it other look.
Upvotes: 3
Reputation: 50573
Usually, when you use a javascript library, you need two files, a .js
which is the javascript code and optionally, a .css
file which contains css formating rules that the library uses to format DOM elements.
In the example you posted you have four lines, that's because you have 2 libraries in there, one is jQuery
, and the other jQuery-ui
, which is a different library that depends on jQuery
one.
About the .min
extension, it indicates the file in question is a minimized version of the library code, that is, it's the normal .js
library file but with spaces removed, variable names changed to short length, and other optimizations in order to obtain a .js
file with a much small file size so it's faster to download and execute by the browser.
Upvotes: 1