我需要判断一个文本宽中注入的数大于一个最大的值,但是我不知道怎么去运用这个验证,好像有一个可以验证的东西不会用
使用bootstrapValidator的between进行校验
示例:
$('form').bootstrapValidator({
message: 'This value is not valid',
feedbackIcons: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
}
fields: {
number: {
message: 'xx验证失败',
validators: {
notEmpty: {
message: 'xx不能为空'
},
integer: {
message: 'xx必须是整数'
},
between: { //范围限制,支持数值型范围校验
min: 6,
max: 18,
message: 'xx必须在6到18之间'
}
}
}
}
});
可以不使用bootstrapValidator啊,input标签type=number的话,有min和max两个属性控制最大最小值的啊