Zain
Zain

Reputation: 285

Pop Up Box Automatic Closing

I need to automatically close the popup box in 3 seconds.

Please help me out guys

html:

<div align="center">
<!--Validation Dialogue box popup-->
<div id="blanket" style="display:none;"></div>
<div id="validationPopup" style="display:none;">
</br>

<div id="validationMessage" align="center"></div>
</div>

<form id="Reject118" name="Reject118" method="post" action="#" onsubmit="return reject_validation(this.name);">
        <input type="submit" class="Reject" name="Reject" id="Reject" value="Reject" title="Click here to Reject this product item & send back for Moderator's Review" />
        <br />
        <textarea name="reject_reason" id="reject_reason" rows="3" cols="9" onblur="if(this.value == '')
{ this.value = 'Type Reject Reason Here';
this.style.color = '#8f8484';}" onfocus="if(this.value == 'Type Reject Reason Here'){ this.value = ''; this.style.color = '#8f8484';}" style="color:#8f8484;">Type Reject Reason Here</textarea>
</form>

My FIDDLE

FIDDLE

Upvotes: 3

Views: 83

Answers (4)

Karim AG
Karim AG

Reputation: 2193

Just add:

window.setTimeout(function() {
    toggle('blanket');
    toggle(windowname);
}, 3000);

to your popup method, and here is your fiddle

Upvotes: 0

Aju Mon
Aju Mon

Reputation: 235

Please add below code

function hideautomatic {
  setTimeout(function () {

    setTimeout(function () {
        $("#yourpop").hide();

    }, 3000);
}, 1000);
};

Upvotes: 0

function Hidepopup() {
            document.getElementById('validationPopup').style.display = "none";
        }
        setTimeout("Hidepopup();", 3000);

Upvotes: 0

SW4
SW4

Reputation: 71150

Im guessing getElementById is the popup element, in which case the below JS should work:

setTimeout(function(){
   document.getElementById('validationPopup').style.display='none';
},3000)

Upvotes: 2

Related Questions