2
A
回答
1
我想你想到會出現類似本
代碼解決方案:
var timer;
$('#tArea').keyup(function(){
clearTimeout(timer);
timer = setTimeout(yourAction, 10000); // interval is set to 10s
});
$('#tArea').keydown(function(){
clearTimeout(timer);
});
function yourAction() {
// Your code goes here
alert("You have not typed anything for the past 10 seconds!!");
}
檢查Demo