jQuery Hello World

First, what is jQuery?

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.


Don’t think jQuery as a new technology. jQuery is rather a new approach to simplify client side web development like the HTML traversing with DOM and AJAX manipulation.
Kudos to the creator of jQuery John Resig.
Now lets get started to enter to the world of jQuery.
First of all, get a fresh copy of jQuery. You can download it from its homepage. jQuery.com
Now open your favorite text editor and create basic HTML wireframe.

<title>jQuery Hello World</title>
<!--body section-->

We have to include jQuery library. Put following code in the head section of your page.

<script src="jquery-1.3.2.js" type="text/javascript"></script>

I have assumed here you have kept your script file along with the html in the same folder.
Now lets add some jQuery thing. Put below code in the head section between script tag after including script file.

// Your code here.
alert("Hello world from jQuery");

$() is the jQuery function and $(document).ready(function(){}) means that the function will be executed when the document is loaded. It is similar to the window.onload function in JavaScript.

Leave a Reply

Your email address will not be published. Required fields are marked *