How to use Callback After Function in jquery

In this article I am going to explain about Callback After function in jquery.
  • 1856

jQuery Callback After function

jquery callback function use for display an message after any action. When event occurs then firstly action will be complete then after a message will be display .

Syntax

$("selector").hide(1000,function(){

      alert("your message");

Example

In this example when you click on button then firstly code will executed then after a message will be display.

<html>

<head>

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

    <script type="text/javascript">

        $(document).ready(function () {

            $("button").click(function () {

                $("h3").hide(1000);

                alert("This heading is now hidden");

            });

        });

    </script>

</head>

<body>

    <button>

        click me</button>

    <h3>

        Click Button For Hide

    </h3>

</body>

</html>

Output

after.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.