Cannot read properties of undefined (reading 'find')
at BootstrapValidator.isValidContainer
导致这个问题的原因是,bootstrap在校验参数的时候,多了一个selector,其实参数是input输入框,所以不要用selector
$('#txtext_edit_form').bootstrapValidator({
feedbackIcons: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields: {
busiStartDate: {
// selector: '#inputBusiStartDate',
validators: {
notEmpty: {message: '开始时间不能为空!'}
}
}, busiEndDate: {
// selector: '#inputBusiEndDate',
validators: {
notEmpty: {message: '结束时间不能为空!'}
}
}, interestPoint: {
// selector: '#inputInterestPoint',
validators: {
notEmpty: {message: '利益点不能为空!'},
// 长度限制
stringLength: {
max: 12,
message: '最多填写12个字'
},
regexp: { //正则表达式
regexp: /^[a-zA-Z0-9\u4e00-\u9fa5]+$/,
message: '只能输入中文、英文、数字'
}
}
}, urlLink: {
// selector: '#inputUrlLink',
validators: {
notEmpty: {message: '跳转链接不能为空!'},
regexp: { //正则表达式
regexp: /^https.*/,
message: '只能以https开头'
},
stringLength: {
max: 500,
message: '输入字符太长'
}
}
}
}
});
代码中注释掉类似这些 // selector: ‘#inputUrlLink’, 就不再报错了