At the time of writing this post, jQuery is available in two lines (1.x and 2.x). Most of the application programming interface (API) remains the same across these two lines. The important change in the 2.x line is that the developer should be aware that jquery 2.x doesn’t support Internet Explorer (IE) 6, 7, and 8.
Adding A Copy Of The Jquery Library To The Local Computer:-
This can be the most basic way to add the jQuery library to your project. I would strongly encourage you to download a copy of the jQuery library to your local computer for development work and testing, and specifically for when an Internet connection is unavailable.
To download and add jQuery, follow these steps:
The
official jquery website(http://jquery.com/) always has the most
up to date
the stable version of the library, which can be downloaded right from
the home page of the site. When the download is complete, you need to give
the JavaScript in an HTML page access to the jQuery library, insert this <script> element
into the HTML page, in the <head> section, before any
other <script> element where you want to use jQuery.
Example:-
<script
src="Scripts/jquery-2.1.1.js"></script>
CDN (content delivery network)
As jQuery’s popularity has grown, Many companies have made the file freely available through their Content Delivery Networks (CDNs).
There are many CDNs available at your disposal, including these:
- jQuery CDN (http://code.jquery.com/)
- Microsoft Ajax CDN (http://www.asp.net/ajaxlibrary/cdn.ashx)
- Google CDN (https://developers.google.com/speed/libraries)
These sites offer the file on powerful, low-latency servers distributed around the world for fast download regardless of the user’s location. To use jQuery library files from these CDNs, you need to know the URLs to the respective jQuery files, which can be found on the web sites of the respective CDNs.
Example:
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
Share this article with your friends
Post A Comment:
0 comments: