The first innerHTML code works without any issues, however the second innerHTML code is causing problems. Its value is set to undefined.
names = ["Man", "Man 2", "Man 3"];
textdata = ["RISIKESI", "This service is amazing",
"Best RISIKESI I have so used!"
];
i = 1;
function anim() {
text = document.getElementById("theText");
text.innerHTML = textdata[i];
name = document.getElementById("theName");
name.innerHTML = names[i];
if (i == 2) {
i = 0;
} else {
i++;
}
}
var int = setInterval(anim, 2000);
<div class="cd-testimonials-wrapper cd-container">
<ul class="cd-testimonials">
<li>
<p id="theText">RISIKESI</p>
<p id="theName" class="t">Man</p>
</li>
</ul>
</div>