How to Use Alert Box With JQuery

In this article I have described about the use of alert Box in JQuery.
  • 2806

Alert Box with JQuery

  • As we know that jQuery Ajax help us to fetch the data from server's database without refreshing the page.
  • In jQuery we can show massage in alert box With the help of JavaScript alert() method.

Syntax

We should use the JavaScript code

<script type="text/javascript">

     $(document).ready(function ()

     {

         $("#al").click(function ()

         {

             alert("WELCOME TO jQuery");

         });

     });

</script>

 

Lets take an example

 

<html>

<head>

<title>Alert Box With jquery</title>

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

 

</head>

 <script type="text/javascript">

     $(document).ready(function ()

     {

         $("#al").click(function ()

         {

             alert("WELCOME TO JQUERY");

         });

     });

</script>

<body>

<font color="red">Show Alert Box </font>

<br>

<br>

<button id="al">Click</button>

</body>

</html>

 

OUTPUT

 

when we run this program

j1.jpg

When we click on button


 j2.jpg

You may also want to read these related articles here

Ask Your Question 


Got a programming related question? You may want to post your question here
© 2020 DotNetHeaven. All rights reserved.