bootstrap正則表達式驗證手機 座機 郵箱


$('#CusForm').bootstrapValidator({
        fields : {
            //驗證手機
            'customer.mobile' : {          //input中的name 值
                validators:{
                    regexp: {
                        regexp: /^1\d{10}$/ ,
                        message: '請輸入正確的11位手機號'
                    }
                    
                }
            },
            //驗證座機
            'customer.phone' : {
                validators:{
                    regexp: {
                        regexp: /^$|(0[0-9]{2,3}\-)?([2-9][0-9]{6,7})+(\-[0-9]{1,4})?$/ ,
                        message: '請輸入正確座機電話'
                    }
                    
                }
            },
            //驗證郵箱
            'customer.email' : {
                validators:{
                    regexp: {
                        regexp: /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/ ,
                        message: '請輸入正確的郵箱地址'
                    }
                    
                }
            },
    
            
        }
    });

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM