i think there is a miss understanding.

either setTimeout(imprime, 3000) or setTimeout("imprime()", 3000) will be
the same because imprime() is in quotes as in a String, even though the
former should be used.

i think what Bissu want is to have a delay between every $(body).append()
if thats the case

function imprime(){

      var cnt = 0, ip = function() {
         if(cnt < 5) {
           $('body').append('<p>Tempo set</p><br/>');
           setTimeout(ip, 3000)
         }
         cnt++;
      }
      ip();
}

i havent test this, not sure if it will work

correct me if i also misunderstood

On Tue, Apr 19, 2011 at 4:21 PM, Rob Griffiths <[email protected]> wrote:

>  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 <http://www.sparrowmailapp.com>
>
> 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]
>

-- 
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]

Reply via email to