Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to use Callback Function in jQuery ?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 193
    Comment on it

    Welcome to FindNerd,
    Today we are going to discuss on Callback Function in jQuery.

    Firstly let know what is the use of Callback Function ?

    This function is executed after the current effect is finished.

    In simple way we can say that callback parameter that is a function that will be executed after the hide effect is completed:

    syntax of callback function

    $(selector).hide(speed,callback);
    <!DOCTYPE html>
    <html>
    <head>
       <!--  here call the jquery library -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    <script>
    $(document).ready(function(){
        $("button").click(function(){
            $("p").hide("slow", function(){ // here weite callback function
                alert("Message! This text is hidden now");
            });
        });
    });
    </script>
    </head>
    <body>
    <!-- here define a hide button for execuiting function -->
    <button>Hide Button</button>
    
    <p>This is a example of callback function</p>
    
    </body>
    </html>
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: