I need to execute a piece of JavaScript code, say, every 2000 milliseconds.
setTimeout('moveItem()',2000)
The above function will be executed after 2000 milliseconds, but will not perform it again.
So, inside my moveItem function, I have:
function moveItem() { jQuery(".stripTransmitter ul li a").trigger('click'); setInterval('moverItem()',2000); }
This does not work because I want to execute the trigger by clicking on a piece of jQuery code every interval of 2000 milliseconds, but now it is being called all the time and the script should be interrupted. Also, I feel this is a very bad coding ... How would you guys solve this?
javascript jquery
Marcos Buarque Jan 25 2018-10-25T00: 00Z
source share