$('#').formValidation校验网址

$('#addCarouselInfoForm').formValidation({

message: '格式不正确',

//不忽略隐藏域验证
excluded: [],
icon: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields: {
//图片上传验证
"fileId" : {
    trigger:"change",
      validators : {              
          notEmpty : {               
          message : '请上传图片'          
           }       
          }   
         },

intro: {
row: '.col-sm-9',
validators: {
notEmpty: {
message: '图片简介名称不能为空'
},
stringLength: {
min: 1,
max: 32,
message: '您已超出最大输入限制'
}
}
},

link: {
row: '.col-sm-9',
validators: {
notEmpty: {
message: '链接不能为空'
},
regexp: {
message: '请输入正确的链接地址',
regexp: /^([hH][tT]{2}[pP]://|[hH][tT]{2}[pP][sS]://)(([A-Za-z0-9-~]+).)+([A-Za-z0-9-~/])+$/,
}
}
},

sort: {
row: '.col-sm-9',
validators: {
notEmpty: {
message: '序号不能为空'
},
stringLength: {
min: 1,
max: 6,
message: '您已超出最大输入限制'
}
}
}
}
}).on('success.form.fv', function(e) {
e.preventDefault();
var $form = $(e.target);

var bv = $form.data('formValidation');
$.post($form.attr('action'), $form.serialize(), function(result) {
if(result.data==true){
//提交成功后回调函数
bt_alert('提示','添加成功');
window.location.href='';
}else{
bt_alert ('提示','添加失败');
}
}, 'json');
});

原文地址:https://www.cnblogs.com/guangxiang/p/10251839.html