jQuery Introduction

jQuery Introduction


jQuery is a new kind of JavaScript Library or FrameWork,created by John Resig in 2006.jQuery is most powerfull JavaScript Library.

jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development.jQuery is designed to change the way that you write JavaScript.

  • jQuery is Lightweight about 18KB in size 
  • jQuery support all major browser.Latest version of browser supports IE 6.0+,FireFox 3.0+,Safari 3.0+,Opera 9.0+.(cross Browser)
  • One thing I want to mentioned that jQuery cannot be "faster" than JavaScript because jQuery written in JavaScript.

How to use jQuery?

First download jQuery latest version (v.1.3.1) from jQuery.com and add javascript to your page.
or Just include javascript <script src="http://code.jquery.com/jquery-latest.js"></script> without download.


Let's take first example to show alert box on page load using jQuery:

 <html>
  <head>
    <script src="
http://code.jquery.com/jquery-latest.js"></script>
    
    <script type="text/javascript">
     $(document).ready(function(){
      alert("Hello friend!!!");
     });
    
    </script>

  </head>
  <body>
   Alert Box On Page Load.
  </body>
  </html>

In above code $(document).ready event is work same as window.onload method of javascript.And executed when entire page and resources have been loaded in the DOM.All the events which you want in jQuery must call inside the $(document).ready() function.

So,The events in Jquery are bound to elements inside the $(document).ready() method.The elements get bound when document.ready is fired.


Also,you can add as many $(document).ready events on your page as you like but they are executed in the order they are added.


0 comments: