国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

javascript - 表單文字方塊鍵盤(pán)回車事件,如何清空文字方塊並指定目前文字方塊?
習(xí)慣沉默
習(xí)慣沉默 2017-05-19 10:45:52
0
1
813

在表單中,鍵盤(pán)輸入回車事件,如何清空文字方塊並製定當(dāng)前文字方塊?

    var str=[];
            $("#ScanCode").keypress(function(event){

                if(event.keyCode==13){
                    var ScanCodeId=$(this).val();
                    if (ScanCodeId==""){
                        return false;
                    }else {
                        //判斷是否重復(fù)
                        for(var i in str){
                            if(str[i]===ScanCodeId){
                                alert('您的條碼與當(dāng)前申請(qǐng)明細(xì)重復(fù),請(qǐng)重新選擇!');
                                return false;
                            }
                        }
                        str.push(ScanCodeId);
                        $.ajax({
                            url: '${ctx}/returns/departmentReturn/json/barcode?barcode='+ScanCodeId,
                            async: false,
                            type: 'get',
                            cache: false,
                            dataType: 'json',
                            success: function (res) {
                                var data = res.rows;
                                if(data==""){
                                    return false;
                                }else {
                                    ScanRow('#departmentReturnDetailsList', departmentReturnDetailsRowIdx, departmentReturnDetailsTpl, data);
                                    departmentReturnDetailsRowIdx = departmentReturnDetailsRowIdx + 1;
                                }
                            }
                        });
                        $(this).val('');
                    }
                    $("#returnReason").blur();
                    $("#ScanCode").focus();

                }

            })

這裡是全部程式碼,求解。 。 。

習(xí)慣沉默
習(xí)慣沉默

全部回覆(1)
某草草

event.keyCode==13這個(gè)是判斷回車的

.val("");//可以用來(lái)清空

.focus();//這個(gè)是獲取焦點(diǎn)的事件

最新下載
更多>
網(wǎng)站特效
網(wǎng)站源碼
網(wǎng)站素材
前端模板