Mod*_* MV 5 forms jquery jquery-validate twitter-bootstrap
我正在使用一个jQuery验证插件,它应该验证表单中的所有输入,但它会在第一个时停止.如果你点击第二个输入并将其留空 - 一切正常 - 它验证...
否则 - 不...
我找到了一些相同的答案 - 没有成功......
这是我写的例子的小提琴
//
// jQuery Validate example script
//
// Prepared by David Cochran
//
// Free for your use -- No warranties, no guarantees!
//
$(document).ready(function(){
// Validate
// http://bassistance.de/jquery-plugins/jquery-plugin-validation/
// http://docs.jquery.com/Plugins/Validation/
// http://docs.jquery.com/Plugins/Validation/validate#toptions
$('.validate').validate({
highlight: function(element) {
$(element).parent().removeClass('has-success').addClass('has-error');
},
success: function(element) {
element.closest().removeClass('has-error').addClass('has-success');
}
});
}); // end document.ready`enter code here`
Run Code Online (Sandbox Code Playgroud)
使用:
Aru*_*hny 16
使用name的领域,而不是id
<div class="form-group">
<label class="control-label" for="login_id">Login id:</label>
<input type="text" class="form-control required" name="login_id">
</div>
<div class="form-group">
<label class="control-label" for="password">Password:</label>
<input type="password" class="form-control required" name="password">
<div class="forgot"> <a href="#">
Forgot your password?
</a>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
演示:小提琴
| 归档时间: |
|
| 查看次数: |
3298 次 |
| 最近记录: |