input Jitter

timely search input, a character input process request data went. But it has not finished entering it began to frequent requests are processed

 

<body>
    <input id="put"/>
</body>
<script>
var put = document.getElementById("put");
var time = null;
put.oninput  = function(){
    clearTimeout(time);
    time = setTimeout(function(){
            console.log("测试");
    },1000);
}
</script>

 

Guess you like

Origin www.cnblogs.com/chenyi4/p/11357924.html