首页 > Web开发 > 详细

jQuery判断输入法和非输入法输入

时间:2018-06-17 14:57:30      阅读:212      评论:0      收藏:0      [点我收藏+]

需求背景:

  页面需要输入完成后自动查询。

解决方案:

$(‘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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!