your setTimeout call is slightly wrong. try setTimeout(imprime, 3000); When you add the brackets, the function is invoked straight away instead of being called by setTimeout
Rob -- Rob Griffiths http://bytespider.eu https://github.com/bytespider -- Rob Griffiths Sent with Sparrow On Monday, 18 April 2011 at 04:51, Bissu wrote: > Hi, > > I am trying to use settimeout, delay (jquery) or even a wait function > implemented, and any of these provide me what I need. > > I would like to put a delay between some instructions, for example: > > $('#btn_update').click(function(){ > var t=setTimeout("imprime()",3000); > }); > > function imprime(){ > for(i=0;i<5;i++){ > $('body').append('<p>Tempo set</p><br/>'); > } > } > > But, all the <p> are appended after the first delay. Am I doing it > right? > > -- > To view archived discussions from the original JSMentors Mailman list: > http://www.mail-archive.com/[email protected]/ > > To search via a non-Google archive, visit here: > http://www.mail-archive.com/[email protected]/ > > To unsubscribe from this group, send email to > [email protected] > -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/[email protected]/ To search via a non-Google archive, visit here: http://www.mail-archive.com/[email protected]/ To unsubscribe from this group, send email to [email protected]
