javascript - How to add .delay to .click on .each iteration (jquery) -
so, want set delay on javascript code.
$(function(){ $('.clickthis').each(function(){ $(this).click(); }); });
i tried this
$(function(){ $('.clickthis').each(function(){ $(this).click().delay(5000); }); });
above script doesnt work .
is there alternative?
i've tried google still couldn't figure out, because have little knowledge in javascript.
this it:
$(function(){ $('.clickthis').each(function(i, that){ settimeout(function(){ $(that).click(); }, 5000*i ); }); });
javascript jquery delayed-execution
No comments:
Post a Comment