jquery 在文本字段中验证
jquery validation in textfield
我在 google 冲浪时得到了插件(jquery 表单验证器),我想进行表单验证,插件在表单验证中的使用,它的工作完美但在控制台中显示错误,
jquery.form-validator.min.js:9 Uncaught TypeError: Cannot read property 'length' of undefined
at HTMLDocument.f (jquery.form-validator.min.js:9)
at HTMLDocument.dispatch (jquery.js:3)
at HTMLDocument.r.handle (jquery.js:3)
at Object.trigger (jquery.js:3)
at m.fn.init.triggerHandler (jquery.js:3)
at Function.ready (jquery.js:2)
at HTMLDocument.J (jquery.js:2)
$.validate({
form: '#form',
modules: 'location, date, security, file',
});
// Restrict presentation length
$('#presentation').restrictLength($('#pres-max-length'));
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-form-validator/2.3.26/jquery.form-validator.min.js"></script>
<div class="form-group col-lg-5">
{!! Form::label('quantities', 'Traded Quantity:') !!} {!! Form::text('quantities', null, ['class'=>'form-control', 'data-validation'=>'length number', 'data-validation-length'=>'3-12', 'data-validation-error-msg'=>'User name has to be an alphanumeric
value (3-12 chars)'])!!}
</div>
您可以按如下方式验证:
$('#form').validate({
rules: {
quantities: {
required: true,
rangelength: [3, 12],
},
other_input_name: "required",
},
});
我在 google 冲浪时得到了插件(jquery 表单验证器),我想进行表单验证,插件在表单验证中的使用,它的工作完美但在控制台中显示错误,
jquery.form-validator.min.js:9 Uncaught TypeError: Cannot read property 'length' of undefined
at HTMLDocument.f (jquery.form-validator.min.js:9)
at HTMLDocument.dispatch (jquery.js:3)
at HTMLDocument.r.handle (jquery.js:3)
at Object.trigger (jquery.js:3)
at m.fn.init.triggerHandler (jquery.js:3)
at Function.ready (jquery.js:2)
at HTMLDocument.J (jquery.js:2)
$.validate({
form: '#form',
modules: 'location, date, security, file',
});
// Restrict presentation length
$('#presentation').restrictLength($('#pres-max-length'));
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-form-validator/2.3.26/jquery.form-validator.min.js"></script>
<div class="form-group col-lg-5">
{!! Form::label('quantities', 'Traded Quantity:') !!} {!! Form::text('quantities', null, ['class'=>'form-control', 'data-validation'=>'length number', 'data-validation-length'=>'3-12', 'data-validation-error-msg'=>'User name has to be an alphanumeric
value (3-12 chars)'])!!}
</div>
您可以按如下方式验证:
$('#form').validate({
rules: {
quantities: {
required: true,
rangelength: [3, 12],
},
other_input_name: "required",
},
});