输入文本框,焦点自动跳转下一个文本框

$(".yhjuan").keydown(function(event){

          var num=event.keyCode;
          if(num!=8){
              if($(this).val().length==4){
                  $(this).next().focus();
              }
          }else{
              if($(this).val().length==0){
                  $(this).prev().focus();
              }
          }
      });

作者:恨_别离 本文版权归作者所有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利,尊重原创,人人有责。

发布了50 篇原创文章 · 获赞 23 · 访问量 6万+

猜你喜欢

转载自blog.csdn.net/u010833154/article/details/51700149