Execute the function automatically in 30 seconds, if the button is not pressed
Posted
by
You Kuper
on Stack Overflow
See other posts from Stack Overflow
or by You Kuper
Published on 2012-09-06T09:31:48Z
Indexed on
2012/09/06
9:38 UTC
Read the original article
Hit count: 129
I want to add the following functionality to my web page: if a user has not pressed the 'Accept' button during 30 seconds, then $('#popupBoxAccept').click( function() {..}
is executed automatically.
$(document).ready(function() {
loadPopupBox();
});
function loadPopupBox() { // to load the Popupbox
$('#popup_box').fadeIn("slow");
}
$('#popupBoxAccept').click( function() {
//...
});
$('#popupBoxDecline').click( function() {
//...
});
<div id="popup_box">
<a id="popupBoxAccept">Accept</a>
<a id="popupBoxDecline">Decline</a>
</div>
© Stack Overflow or respective owner