面对将Jquery变量调用到Bootstrap验证器中的问题。声明了一个变量tempValue以及将该变量用于我的自定义函数2的语法
$(document).ready(function () {
var tempValue = $('#firstName').val();
$('#registration').bootstrapValidator({
feedbackIcons: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields: {
firstName: {
validators: {
stringLength: {
min: 1,
max: 50,
message: 'First name cannot exceed 50 characters'
},
notEmpty: {
message: 'Please enter your first name'
},
customFunction1: {
keyValue: customFunction2(tempValue)
}
}
});
});