title: How to make each letter in text a different random color in Javascript
body: <p>I am trying to make every letter in a small line of text a different random color. I can only seem to make it do this when I use .hover, but I want it to do the action straight away (once the page loads). Please help. I would also like to know if anyone knows how to just set different colors on each letter (set colors) with css or Javascript because when I tried to do it in that way, it wouldnt allow me call a function on the same div/id (i tried to arch the text). Thank you.</p>
  
  <p>THIS IS MY CODE</p>
  
  <pre><code>var colours = ["#000000", "#FF0000", "#990066", "#FF9966", "#996666", "#00FF00", "#CC9933"], 
      idx;
  
  $("#arch").hover(function(){
      var div = $(this); 
      var chars = div.text().split('');
      div.html('');     
      for(var i=0; i&lt;chars.length; i++) {
          idx = Math.floor(Math.random() * colours.length);
          var span = $('&lt;span&gt;' + chars[i] + '&lt;/span&gt;').css("color", colours[idx])
          div.append(span);
      }
  
  }, function() {
      $(this).find('span').css("color","#FF0000");
  });
  </code></pre>