如何解决表单Validation.io无法在标准html和CSS项目中使用
我已经用VS代码启动了一个新的空白HTML,CSS和Bootstrap项目,并添加了FormValidation.io,但是由于某种原因,它还没有到来,我所做的只是他们的主要例子,有人有想法吗?为什么,这是否需要与框架分开(反应,观点),或者我只是缺少什么?但是当我单击“提交”按钮时没有任何反应
<html>
<head>
<link rel="stylesheet" href="/plugins/bootstrap/css/bootstrap.min.css" />
<link rel="stylesheet" href="/plugins/formvalidation/dist/css/formValidation.min.css" />
</head>
<body>
<div class="container">
<div class="row">
<div class="col-xl-6">
<form id="loginForm" method="POST">
<div class="form-group">
<label>Username</label>
<input class="form-control" type="text" name="username" />
</div>
<div class="form-group">
<label>Password</label>
<input class="form-control" type="password" name="password" />
</div>
<button class="btn btn-primary" type="submit">Submit</button>
</form>
</div>
</div>
</div>
<script src="/plugins/jquery.js"></script>
<script src="/plugins/bootstrap/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.35.3/es6-shim.min.js"></script>
<script src="/plugins/formvalidation/dist/js/FormValidation.full.min.js"></script>
<script src="/plugins/formvalidation/dist/js/plugins/Bootstrap.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded',function(e) {
FormValidation.formValidation(
document.getElementById('loginForm'),{
fields: {
username: {
validators: {
notEmpty: {
message: 'The username is required'
},stringLength: {
min: 6,max: 30,message: 'The username must be more than 6 and less than 30 characters long',},regexp: {
regexp: /^[a-zA-Z0-9_]+$/,message: 'The username can only consist of alphabetical,number and underscore',}
},password: {
validators: {
notEmpty: {
message: 'The password is required'
},stringLength: {
min: 8,message: 'The password must have at least 8 characters',plugins: {
bootstrap: new FormValidation.plugins.Bootstrap(),}
);
});
</script>
</body>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。