jQuery Hello World alert

Develop jQuery Hello World alert example. This jQuery example shows how to use alert() function in jQuery.

jQuery Hello World alert example


This section guides you  to create a program which display "Hello World" alert box using jQuery. This application will use the JavaScript alert() method to display the "Hello World" message.

In this example you will learn how to write JavaScript using jQuery. When user clicks on the button "Click Me", the alert message is displayed to the user.

The following method is used to attached the click event to the button:


The above code of jQuery handles the button click event and then executes the JavaScript defined in the curly braces{}. In the curly braces we have defined the JavaScript alert() method.

Hello world alert box example(HelloAlert.html)

<title>jQuery Hello World Alert box</title>
<script type="text/javascript" src="jquery-1.4.2.js"></script>
 <script type="text/javascript">
alert("HELLO WORLD!");
<font color="red">CLICK BELOW BUTTON TO SEE ALERT BOX</font>
<button id="cl">Click Me</button>

Here is the video instruction of running the example program - How to display alert message in jQuery?

Description of the program

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 Html page contains a button named "cl", when click event is triggered on this element , it will display a alert box showing message "Hello World". The "alert()" function of jQuery creates a alert box having provided message.

alert("HELLO WORLD!");


When you click on button , it will display :

Download Source Code

See here to see online demo

Learn from experts! Attend jQuery Training classes.

Share on Google+Share on Google+

jQuery Hello World alert

Posted on: September 2, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles



Discuss: jQuery Hello World alert  

Post your Comment

Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
June 29, 2011
Just for one question

Why the script tag is not in the head tag ,
September 23, 2011

Just do me a favor and keep wtriing such trenchant analyses, OK?
December 1, 2011
alert jquery

good post thank u
thainese victoria
February 3, 2012
jquery samples for beginners can be clear

can u give me the exact learning for jquery?
August 30, 2012

hello world
surbhi mathur
December 4, 2012
alertbox value for dynamic data

Hiee....I am working on project in which i want by click on particular student name then alert box would be open with its particular details.Can anyone help me with the code.?? thanx