How can I add a delay on the return statement of a confirm box? I have tried using setTimeout but it doesn't work.
My idea is to display a modal for 5 seconds and then take the user to the signout page.
<a href='signout.cgi?id=$key' onclick='singOutConfirm()'> Sign Out</a>
function singOutConfirm(){
var c = confirm("Confirm Sign Out!");
var modal = document.getElementById('myModal');
console.log(c);
if(c == true ) {
setTimeout(function(){
return c;
}, 5000);
}
return c;