js 為 bootstrap input 賦值
阿新 • • 發佈:2018-12-14
$("input[name='vinEndLike']").val(vin);
此時 input 已經賦值上去了,但是校驗並沒有通過;
$("input[name='vinEndLike']").val(vin);
$("#carInfoForm").data('bootstrapValidator').updateStatus('vinEndLike', 'stringLength').validateField('vinEndLike');
bootstrap bootstrapValidator
//表單驗證 $('#carInfoForm').bootstrapValidator({ feedbackIcons: { valid: 'glyphicon glyphicon-ok', invalid: 'glyphicon glyphicon-remove', validating: 'glyphicon glyphicon-refresh' }, fields: { vinEndLike: { validators: { notEmpty: {message: '車身號不能為空'}, stringLength: {min: 6, message: '最少輸入最後6位'} } } } });