Reputation: 5790
I have used jquery dialog i want it to close automatically after say 2 seconds..How can i acheieve this ? i tried fadeout function but nothing works...
//Below Code will get executed if successful operation does not happen...below code is included in "Save" button of another dialog
window.parent.$('#divDialog').dialog('close');
window.parent.$('#divDialog').dialog('destroy');
window.parent.$('#divDialog').html(sMessage);
window.parent.$('#divDialog').attr('title', (((parseInt(response) != NaN)) ? 'Error' : 'Notice'));
window.parent.$('#divDialog').dialog({ show: "blind", modal: true, dialogClass: 'alert', zIndex: 99999 });
Upvotes: 3
Views: 3428
Reputation: 4536
You're looking for the Javascript (not specifically jQuery) setTimeout()
function - it executes a piece of code after a specified number of milliseconds.
Upvotes: 2
Reputation: 66971
setTimeout( function () {
window.parent.$('#divDialog').dialog('close');
}, 2000 // milliseconds delay
);
Upvotes: 5