Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

prototype - how to delay a call to hide() by 10 seconds

I have the following code:

$('message').show();
$('message').hide();

How do I add a 10 second delay between the show and hide in prototype?

Thanks

like image 772
jon colins Avatar asked Feb 04 '10 10:02

jon colins


People also ask

How do I display a div for 5 seconds?

If it's not an animation, use setTimeout() directly, like this: $("#myElem"). show(); setTimeout(function() { $("#myElem"). hide(); }, 5000);

How do you wait for loop to finish?

To use Javascript promises in a for loop, use async / await . This waits for each promiseAction to complete before continuing to the next iteration in the loop.


2 Answers

$('message').show();
Element.hide.delay(10, 'message');
like image 98
artlung Avatar answered Sep 18 '22 01:09

artlung


You can use the delay function

like image 30
rahul Avatar answered Sep 19 '22 01:09

rahul