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 error. To avoid this, we can create Callback function.

JQuery Callback Function Syntax

Syntax: $(selector).hide(speed,callback);

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

        $(document).ready(function () {
            $("button").click(function () {
                $("p").hide("slow", function () {
                    alert("This line is now hide.");
You may like this - 5 Essential Points to Become a skilled Full Stack Developer

Other blogs on JQuery

Leave a Comment