I need some help with a js code. I've searched in other topics and i've tried some codes, but they didn't work. I need to change 2 text every 3 seconds and also the second text has to change their colour.
I used an jquery code, and the first part is done, but i don't know how to do the second.
This is my code
<html>
<head>
<script src="js/jquery-2.1.4.min.js" type="text/javascript"></script>
<script>
$(function () {
cuenta = 0;
txtArray = ["TEXT1", "TEXT2"];
setInterval (function () {
cuenta++;
$("#titulos").fadeOut(100, function () {
$(this).text(txtArray [cuenta % txtArray.length]).fadeIn(100);
});
}, 3000);
});
</script>
<body>
<div>
<p id="titulos">TEXT1</p>
</div>
</body>
</html>
How can I change the colour of the second array? Is there any other way to make this code with pure js, not with jquery?
Thanks for all