Quantcast
Channel: User JohnP - Stack Overflow
Viewing all articles
Browse latest Browse all 37

Answer by JohnP for Run function after user has stopped typing

$
0
0

Here's a rough draft : http://jsfiddle.net/jomanlk/msmJp/

Uses setTimeout and clearTimeout

var timer = null;    $('#text').keyup(function(){           clearTimeout(timer);            timer = setTimeout(doStuff, 1000)    });    function doStuff() {        alert('do stuff');    }
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script><input type='text' id='text'>

Viewing all articles
Browse latest Browse all 37

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>