I am having a function which take some time to complete it's process. So I am planning to display the process image until it's going to finish.
Please take a look at the sample here.when the user clicks on the button process will start. Here I put setTimeout function to make delay.But the processing image is not showing.
If I am placing the code for hiding the image inside setTimeout function it is working.
But in actual code that is also not working.
Also I tried with
$.when($("#loaderImg").show()).done(function(){
showSomeProcess()
$("#loaderImg").hide();
})
So please help me with this sample code. I dont understand why the processing image is not showing.
Use of promise will solve your problem. Updated fiddle also https://jsfiddle.net/3espztjw/5/