Skip to content

Instantly share code, notes, and snippets.

@nathanleclaire
Last active December 11, 2015 06:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nathanleclaire/4558564 to your computer and use it in GitHub Desktop.
Save nathanleclaire/4558564 to your computer and use it in GitHub Desktop.
I figured out the answer to this question :)
<!doctype html>
<html>
<head>
<title>Interval Shenanigans</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<style>
input {
margin: 20px;
}
</style>
</head>
<body>
<input type="text" id="myBox" />
<script>
function popUp() {
if (this.timeoutId) window.clearInterval(this.timeoutId);
this.timeoutId = window.setTimeout(function () {
$('body').append('timeout timeout timeout');
}, 2000);
}
$('#myBox').keypress(popUp);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment