Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Close Modal Box after 10 seconds

Tags:

jquery

How can i close the jquery modal box after 10 seconds ???

like image 316
Shaun Avatar asked Mar 03 '11 11:03

Shaun


People also ask

How do you automatically close a modal?

Modals are built with HTML, CSS, and JavaScript. They're positioned over everything else in the document and remove scroll from the <body> so that modal content scrolls instead. Clicking on the modal “backdrop” will automatically close the modal.

How do I add a close button on modal pop up?

The close button can be added by using the simple markup with CSS class. The main container for close button is the <button> tag with . close class.


2 Answers

Use setTimeOut function.

//make sure you have lower case "o"
setTimeout(function(){
    $(dialog).close();
}, 10000);
like image 108
gor Avatar answered Oct 05 '22 23:10

gor


setTimeout(function()
{

   // code to close the modal

}, 10000);
like image 30
Alex Avatar answered Oct 06 '22 01:10

Alex