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 strai
Try (untested):
$(document).ready(function(){
var div = $('#arch');
var chars = div.text().split('');
div.html('');
for(var i=0; i' + chars[i] + '').css("color", colours[idx])
div.append(span);
}
}
Basically, you need to wait for the DOM to load so that there's a div to find when you call $('#arch')!
I'm not sure what you mean by "tried to arch the text".