我是網絡開發新手,在這裏我知道問題非常小,但即使在兩天後,我也無法找到它。你的人可以看看這個代碼,並指出我的錯誤,請爲什麼BootstrapValidator無法正常工作?
我的代碼標識here @ JSFiddle 感謝
HTML
<form id="registerForm" action="\register" method="post">
<div class="form-group">
<input class="form-control" type="text" name="email" placeholder="Email">
</div>
<div class="form-group">
<input class="form-control" type="password" name="pass1" placeholder="Password">
</div>
<div class="form-group">
<input class="form-control" type="password" name="pass2" placeholder="Confirm Password">
</div>
<button class="btn btn-primary" type="submit">Signup</button>
</form>
JS
$(document).ready(function() {
$('.registerForm').bootstrapValidator({
message: 'This value is not valid',
feedbackIcons: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields: {
email: {
validators: {
notEmpty: {
message: 'The email is required and cannot be empty'
},
emailAddress: {
message: 'The input is not a valid email address'
}
}
},
pass1: {
validators: {
identical: {
field: 'pass2',
message: 'The password and its confirm are not the same'
}
}
},
pass2: {
validators: {
identical: {
field: 'pass1',
message: 'The password and its confirm are not the same'
}
}
}
}
});
});
有什麼問題?正好 – 2014-10-04 07:40:44
http://jsfiddle.net/victor_007/uw0afL1u/1/如果您將類從作品更改爲id – 2014-10-04 07:42:16