BootstrapValidator 使用
基本版本:3.3.7
1、基本引入
bootstrapValidator.min.css、bootstrapValidator.min.js
2、Javascript使用
$('form').bootstrapValidator({
message: 'This value is not valid',
feedbackIcons: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields: {
name: {
message: '验证失败',
validators: {
notEmpty: {
message: '验证不能为空'
},
stringLength: {
min: 1,
max: 64,
message: '验证长度必须在1到64位之间'
}
}
},
keywords: {
message: '关键字不能为空',
validators: {
notEmpty: {
message: '关键字不能为空'
}
}
},
desc: {
message: '概要不能为空',
validators: {
notEmpty: {
message: '概要不能为空'
}
},
stringLength: {
min:30,
max: 256,
message: '备注长度长度必须小于256'
}
}
}
}).on('success.form.bv', function(e) {
//TO DO something
})