Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Ajax Jquery jQuery alert()

Related Tutorials


 
 

Share on Google+Share on Google+

jQuery alert()

Advertisement
In an application alert boxes are used to provide information at run time. These information helps user of applications to do tasks further with more information at runtime.

jQuery alert()

In this section we will discuss about alert box in jQuery.

In an application alert boxes are used to provide information at run time. These information helps user of applications to do tasks further with more information at runtime. Alert box can be popped up after happening an event such as click event or after completing a line of code execution. .click() function in jQuery helps in to bind the click event, JavaScript event.

Example

Here I am giving a simple example which will demonstrate you about how an alert box can display information. In this example we will display an alert box after clicking a button and the click event is generated. When a user will execute this example and click on the button then the alert box will be displayed.

jQueryAlertExample.html

<!DOCTYPE html>
<html>
<head>
<title>jQuery Alert Example</title>
<style>
p { color:red; margin:5px; cursor:pointer; }
p:hover { background:yellow; }
</style>
<script type="text/javascript" src="jquery-1.9.1.js"></script>
</head>
<script type="text/javascript">
$(document).ready(function(){
$("#b1").click(function(){
alert("jQuery alert box example !");
});
});
</script>
<body>
<p>Click on button</p>
<button id="b1">Click Here</button>
</body>
</html>

Output

To run the above example you will have to download the jquery-1.9.1.js file. When you will run the above example then the output will be as follows :

Download Source Code

Advertisements

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  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.

Posted on: May 4, 2013

Related Tutorials

Discuss: jQuery alert()  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0
DMCA.com