In the below piece of code I tried to make the objects with class "rot" to change the inner HTML by using the value attribute that includes an array of chars.
I want that this characters will rotate with an interval.
I noticed that the problem is in the inner for loop - I need there a setTimeout or something like this but it doesn't work.
any solution for this problem?
Thanks in advance.
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<span class="rot" value="$^%^@">currency</span>
<span class="rot" value="1^2^3">numbers</span>
<script>
function rotateItem()
{
for(j=0;j<$(".rot").get().length;j++)
{
valueToRotate = $(".rot:eq("+j+")").attr("value").split("^");
for(i=0;i<valueToRotate.length;i++)
{
$(".rot:eq("+j+")").html(valueToRotate[i]);
}
}
}
setInterval("rotateItem()",1000)
</script>