How to print the letters Loading… one by one in jquery or php? [closed]

This script should work for you. (Place it where you want the text to go).

<script>
  (function(D){
      var text="Loading";

      var scripts = D.getElementsByTagName('script');
      var this_script = scripts[scripts.length - 1];

      var container = D.createElement('span');
      this_script.parentNode.insertBefore(container, this_script);

      (function next(i){
          container.innerHTML += text[i] + ' ';
          if(++i < text.length)
              setTimeout(function(){ next(i); }, 1000);
      })(0);
  })(document);
</script>

Leave a Comment