JQ判断输入法

前端开发   发布日期:2023年05月04日   浏览次数:533
  1. <input name="zc_code" id="zc_code" type="text" value="" class="zc_code" maxlength="15"/>
  2.  
  3. <script>
  4. function get_shurufa(){
  5.     $('#zc_code').on('input', function() {
  6.     if ($(this).prop('comStart')) return;  //中文输入过程中不截断
  7.         console.log('当前输入:' + $(this).val());
  8.     }).on('compositionstart', function(){
  9.         $(this).prop('comStart', true);
  10.         console.log('中文输入:开始->' + $(this).val());
  11.     }).on('compositionend', function(){
  12.         $(this).prop('comStart', false);
  13.         console.log('中文输入:结束->'  + $(this).val());
  14.     });
  15. }
  16. $(document).ready(function(){
  17.     get_shurufa()
  18. });
  19. </script>


以上就是JQ判断输入法的详细内容,更多关于JQ判断输入法的资料请关注九品源码其它相关文章!