需求背景:
页面需要输入完成后自动查询。
解决方案:
$(‘input‘).on(‘input‘, function() { ???if ($(this).prop(‘comStart‘)) return; ???console.log(‘当前输入:‘ + $(this).val());}).on(‘compositionstart‘, function(){ ???$(this).prop(‘comStart‘, true); ???console.log(‘中文输入:开始->‘ + $(this).val());}).on(‘compositionend‘, function(){ ???$(this).prop(‘comStart‘, false); ???console.log(‘中文输入:结束->‘ ?+ $(this).val());});
jQuery判断输入法和非输入法输入
原文地址:https://www.cnblogs.com/boeing-bick/p/9192848.html