Using Jquery Callback Function
JavaScript commands are processed line by line. Of course, these operations are carried out very quickly by the computer. That's why we need to better control the operation of the commands we write.
For example, we used an effect on the page and we have codes after the effect. While our page is running, it should not be forgotten that the next codes will start working before the effect ends, and the codes should be written accordingly.
If there are codes that we want to run after an effect has completely ended, callback functions are used in such cases.
When we use a callback function within an effect, we can be sure that the codes within the callback function will not run until the effect ends.
$("#button1").click(function(){
$("#box1").hide("slow", function(){
alert("box1 hidden");
});
});