jQuery Callback Functions
A callback function is a function that is executed once the effect is complete. The callback function is passed as an argument to the effect methods and they typically appear as the last argument of the method.
Example of Code
<style type="text/css">
p{
background:red;
font-size: 24px;
padding:20px;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$(".example-jquery-callback-button").click(function(){
$(".example-jquery-callback-paragraph").slideToggle("slow", function(){
alert("The slide toggle effect has completed.");
});
});
});
</script>
<p class="example-jquery-callback-paragraph">Paragraph will be sliding when you click on button.</p>
<button type="button" class="example-jquery-callback-button">Click Here</button>
Output
Paragraph will be sliding when you click on button.
