Ila*_*sda 5 jquery jquery-validate
我正在使用jQuery Validation(PLUGIN URL)插件进行大部分表单验证:
我有以下示例(实际示例):
形成:
<form class="form" id="feedback-form" method="post" action="#">
<label for="phone">Contact number:</label>
<input type="text" value="" id="phone" name="phone" class="required">
<br class="clr">
<div class="form-buttons">
<input id="submit" type="submit" value="Submit" class="button" >
</div>
<br class="clr">
<br /><br />
</form>
Run Code Online (Sandbox Code Playgroud)
jQuery的:
$("#feedback-form").validate({
rules: {
phone: {
number: true, // as space is not a number it will return an error
minlength: 6, // will count space
maxlength: 9
}
}
});
Run Code Online (Sandbox Code Playgroud)
我有两个问题,都与空间使用有关.
number = true和space一起使用时,它会返回错误,因为空格不是数字这有什么解决方法吗?有没有人遇到过同样的问题?请注意我想继续允许输入空格(为了便于阅读).