我正在使用Bootstrap Validator插件来验证我的表单,并且我正在尝试在表单成功验证时发出警报。
HTML
<form id="defaultForm" role="form">
<div class="form-group">
<label for="eventName">Event Name</label>
<input type="text" class="input-sm form-control" id="eventName" name="name" placeholder="...">
</div>
<button class="btn btn-sm">Add</button>
</form>
JS
$('#defaultForm').bootstrapValidator({
live: 'enabled',
fields: {
name: {
validators: {
notEmpty: {
message: 'The Evenr Name is required and cannot be empty',
onSuccess: function(e, data) {
alert('Success');
}
},
}
}
}
});
我已经根据这个https://github.com/nghuuphuoc/bootstrapvalidator/issues/195尝试过这个
我的表单正在验证,但它没有提醒成功消息。我怎样才能正确地提醒它?