Thursday 23 April 2015

Introduction to jQuery

jQuery is a lightweight "write less, do more" JavaScript library. The purpose of jQuery is to make JavaScript easy to use on our website. jQuery take a lot of common task that requires a lot of JavaScript code and wraps them into less code or just a single line. jQuery also simplifies a lot of complicated things from JavaScript like AJAX calls, and DOM manipulation. The jQuery library contains the following features.
  • HTML/DOM manipulation
  • CSS manipulation
  • HTML event methods
  • Effects and Animations
  • AJAX
  • Utilities
There are a lot of other JavaScript frameworks out there, but jQuery seems to be the most popular, and also the most expendable. This is because the jQuery team have written the knowledge of cross-browser issues into the jQuery library. Therefore, it will exactly the same in all browsers, including Internet Explorer 6. Many of the biggest companies use jQuery:
  • Google
  • Microsoft
  • IBM

Addding jQuery to your webpage

There are several ways to add jQuery on your website.
  • Download the jQuery library from jQuery.com
  • Include jQuery from a CDN

Downloading jQuery

There are two versions of jQuery available for downloading:
  • Production Version
  • Development Version
The jQuery library is a single JavaScript file and should be linked with the HTML <script> tag
<head>
<script src="jquery-1.11.0.min.js"></script>
</head>

Alternatives to Downloading

If you don't want to download and host jQuery directly, you can include it from a CDN (Content Delivery Network). Both Google and Microsoft host jQuery

Google CDN:
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/<br />jquery.min.js"></script>
</head>
Microsoft CDN:
<head>
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.11.0.min.js"></script>
</head>

0 comments:

Post a Comment