Share on Google+Share on Google+

jQuery tutorial for beginners with examples

Here we will discuss jQuery tutorial with a simple Hello World example so that beginners can understand how jQuery is used in programming.

In this section we will create a simple Hello World example using jQuery library that will help beginners understand how jQuery can be used within their programming and how does it works. But first a brief introduction about jQuery.

jQuery is a library that provides functions and methods to makes rich Ajax based application. Due to simple features and easy development, jQuery is very famous among developers, who use it to develop web 2.0 applications.

jQuery library is designed to keep code simple, concise and reusable. It can be used in all the web based applications irrespective of the technology.

jQuery library simplifies the programming in JavaScript and can be used to traverse and select tings from HTML pages. It can handle events, perform animation, and add the Ajax support in a web application.

jQuery library can be used along with JSP, Servlets, ASP, PHP, CGI and other languages.

jQuery Hello World example:

Here we will create out first Hello world example using jQuery, which will simply display "Hello World !! (display due to jQuery)" message in browser. It will help you understand how jQuery works and can be used in our programming.

To create your first program you need jQeury library. Download it from:

Save the jQuery library script file of around 70kb as "jquery-1.4.2.js".

Hello World Example

<title>jQuery Hello World</title>

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


<script type="text/javascript">

$("#flag").html("Hello World !! (display due to jQuery)");

<font color=red>
Hello World !! (display due to HTML)
<font color=blue>
<div id="flag">


We used the jQuery library, which you downloaded by the following tag:

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

If you saved the library in another folder, you need to provide the relative path or you can save it in the same page you are saving the html page.

Look precisely the below code :

<script type="text/javascript">

$("#flag").html("Hello World !! (display due to jQuery)");


For using jQuery script ,we write it inside <script> tag. The below code checks whether the page loading is finished (DOM elements are ready or fully loaded) and if page loading is finished then it executes the code in the block.

// Your code here

The code given below set the message at div "flag" in html form :

$("#flag").html("Hello World !! (display due to jQuery)");});



Posted on: October 4, 2013 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Discuss: jQuery tutorial for beginners with examples  

Post your Comment

Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image