I have this code:
<div id="list" rows="10"></div>
<script>
$(function() {
setTime();
function setTime() {
$.ajax({
url : "../abc.php",
dataType: "text",
success : function (result) {
$("#list").html(result);
}
});
var date = new Date().getTime();
setTimeout(setTime, 3000);
$('#list').html(result);
//Here should call a function to color all the words of the div
}
});
</script>
});
I'm trying to color all letters every 3 seconds using the setTime () function.
Note: I'm trying to color each letter of a word, in other words, each letter will have a color
Like:
https://i.imgur.com/Tw2Q58U.png
I tried with this code, but it changes the color of the entire div(The div stay with only one color):
var randomColor = Math.floor(Math.random()*16777215).toString(16);
document.getElementById('list').style.color = '#' + randomColor