Bigballs Bigballs - 5 months ago 32
HTML Question

jquery wait cursor while loading html in div

I want to show to the user a state that the result is loading.
How can I change cursor or gif while loading result in div with $MyDiv.load("page.php") ?

Answer
  1. Initially style the loading image non-visible.
  2. Change the style to visible when you begin loading.
  3. Change the style to non-visible when loading finished using a callback argument to load().

Example:

 $("#loadImage").show();
 $("#MyDiv").load("page.php", {limit: 25}, function(){
   $("#loadImage").hide();
 });