I am trying to display text from the array one by one on my website, i'm able to do it once but i wish to repeat the list again and again (start over) as long as the user keep the page open.
The below code works without while loop but only once:
<h1 id="looper" ></h1>
<script>
var i = ["ਸਤਿ ਸ੍ਰੀ ਅਕਾਲ", "Hello", "hola", "नमस्ते", "你好!", "Здравствуйте"];
for( var j = 0 ; j < i.length; j++ ) {
setTimeout( (function(j){ return function(){$("#looper").text(i[j]);}})(j), j*1000 );
}
</script>
But when i use while loop the browser gets overloaded or freezes.
while(true){
for( var j = 0 ; j < i.length; j++ ) {
setTimeout( (function(j){ return function(){$("#looper").text(i[j]);}})(j), j*1000 );
}
};
I'm working with Django, in case if it can be done using python as well.