jQuery Callback

jQuery callback function is executed just after the current effect is 100% finished.As we know JavaScript code are executed line by line.But some times jQuery effect takes some time to finish the next line code may execute while the previous effect is still running. To Prevent this situation jQuery provides a callback function.

We can pass callback function as an argument to the effect methods and they typically appear as the last argument of the method.




jQuery Callback Example

<!DOCTYPE html> 
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<title>jQuery Callback Example </title>
<button>Click Me</button>
<div style="height:100px;width:200px;display:none;">
Use of jQuery Callback
<script type="text/javascript">
        $("div").show("slow", function(){
            alert("The paragraph is now visible");