(网页)习惯了CS回车操作人员,操作BS网页表单也是回车666

1.第一步把表单,里面需要回车的input,或者是其他的表单按钮给一个clsss,例如下面的$('.cls');

2.第二步,  把下面的代码复制过去,填写完最后一个自动提交:$("#savedown").click();

3.选中input的框的时候一定要全部选中,不然操作会不方便,给一个提示

----------------------------------------------------------------------------------------------------------------------------------------

$("input").focus(function() {
                        this.select();
                    });   

-----------------------------------------------------------------------------------------------------------------------------------------

<input style="width:208px;" id="onlyshipid" class="form-control cls" type="text" onblur="clearorchangeNum()">

<input style="width:208px;" id="onlyshipid" class="form-control cls" type="text" onblur="clearorchangeNum()">

$(function(){
                    $("input").focus(function() {
                        this.select();
                    });    
                    $('#goodsnameid').focus();
                    var $inp = $('.cls');
                    $inp.bind('keydown', function (e) {
                    var key = e.which;
                    if (key == 13) {
                        e.preventDefault();
                        var nxtIdx = $inp.index(this) + 1;                
                        if($('.cls').size() == nxtIdx){
                            $("#savedown").click();
                            $(".cls:eq(" + 0 + ")").focus();
                            $(".cls:eq(" + 0 + ")").select();
                        }else{                        
                            $(".cls:eq(" + nxtIdx + ")").focus();
                            $(".cls:eq(" + nxtIdx + ")").select();
                            
                        }
                    }  
                });
        });   

 

posted on 2017-07-20 19:55  六一儿童节  阅读(337)  评论(0编辑  收藏  举报

导航