gpt4 book ai didi

javascript - 未捕获的TypeError:$(…).formValidation不是函数JQUERY验证

转载 作者:行者123 更新时间:2023-12-03 05:13:19 26 4
gpt4 key购买 nike

这是我表单中一个字段的代码,用于unit_name。

$(document).ready(function() {
$('#alwaysEnableButtonForm').formValidation({
framework: 'bootstrap',
icon: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields: {
unit_name: {
validators: {
notEmpty: {
message: 'The task is required'
}
}
}
}
})
.on('err.field.fv', function(e, data) {
// $(e.target) --> The field element
// data.fv --> The FormValidation instance
// data.field --> The field name
// data.element --> The field element

data.fv.disableSubmitButtons(false);
})
.on('success.field.fv', function(e, data) {
// e, data parameters are the same as in err.field.fv event handler
// Despite that the field is valid, by default, the submit button will be disabled if all the following conditions meet
// - The submit button is clicked
// - The form is invalid
data.fv.disableSubmitButtons(false);
});
});
</script>


**
这是我用于表单验证的JQUERY代码

有谁能够帮助我?

这是我的错误语法:

Uncaught TypeError: $(...).formValidation is not a function
at HTMLDocument.<anonymous> ((index):137)
at j (jquery.js:3099)
at Object.fireWith [as resolveWith] (jquery.js:3211)
at Function.ready (jquery.js:3417)
at HTMLDocument.I (jquery.js:3433)


这是我用来调用jquery验证的导入。

<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.14.0/jquery.validate.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>


这是我用来显示验证信息的表格

<form name="#" method="POST" name="myForm" id="alwaysEnableButtonForm" >
<fieldset>
<legend>Insert unit:</legend>



<div class="form-group">
<label class="col-xs-3 control-label">Name unity: </label>
<div class="col-xs-5">
<input type="text" class="form-control" placeholder="name concept" name="unit_name" />
</div>
</div>

<input type="hidden" name="state" value="insert">
<div class="form-group">
<div class="col-xs-5 col-xs-offset-3">
<button type="submit" class="btn btn-default">Submit</button>
</div>
</div>
</fieldset>
</form>

最佳答案

您将在此处包含脚本:https://jqueryvalidation.org/

但是您自己的脚本正在尝试使用以下api命令设置验证:http://formvalidation.io/,这是一个不同的商业jQuery验证库。

关于javascript - 未捕获的TypeError:$(…).formValidation不是函数JQUERY验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41709029/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com