Sunday, 17 April 2016

What is JQuery Callback Function

What is JQuery Callback Function?

A call back function executed after the current event has completed. Java Script code executes line by line. However if next line of code executes even before completing the action(s) which wrote in previous lines. This may create an errors.




To avoid this we can create a callback functions. Below is a sample script for Jquery Callback function.

<script>
        $(document).ready(function () {
            $("button").click(function () {
                $("p").hide("slow", function () {
                    alert("This line is now hide.");
                });
            });
        });

</script>

No comments:

Post a Comment