【发布时间】:2013-11-04 06:11:58
【问题描述】:
在文本框上按下时,按键不会检测到CTRL + V。我见过与我类似的post。但是我们有不同的实现。如果用户空闲输入 1.5 秒,我想触发 ajax 请求。
$(document).ready( function() {
$(document).on('keypress', '#subject-name', function() {
updateTimeOut( this, checkSubject );
});
});
updateTimeOut() 方法是这样的:
var updateTimeOut = function( textBoxObject, ajaxCall ) {
if (timeoutReference) clearTimeout(timeoutReference);
timeoutReference = setTimeout(function() {
doneTyping.call( textBoxObject, ajaxCall );
}, 1500);
};
我的问题是。最好使用change 不是更好地完成我的任务吗? change 也可以做间隔检查吗?
【问题讨论】:
标签: javascript jquery