- Write this code outside the on ready function.
2 .Write all this code inside one function like function automaticTime ();
Then in on ready function write below code;
automaticTime ();
And add at the end of the function ;
setTimeout(automaticTime,1000);
Hope it helps:)
Tell me if you are facing any issues still