Jquery Callback Function Example - Jquery

How to use callback function using jquery?

Snippet Code


  
Rate this page :
  [ 0 votes]

This jquery callback code is used to execute the function after the current function is executed completely. Here, callback alert message is displayed after the p tag content hides. Sample jquery callback function code is given below.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script><script type='text/javascript'> $(document).ready(function(){ $("#btn").click(function(){ $("p").hide("slow", function(){ alert("Alert is called only after the paragraph hides."); }); }); }); </script> <input type='button' value='Callback Alert' id='btn'> <p>This is a sample jquery callback example.</p>

Tags


Ask Questions

Ask Question