需要验证文本框的值,并抛出错误,如果它包含字母,特殊字符或数字小于20jQuery的验证特殊字符的
代码:
<input type="text" class="input-text-bx" id="actual" value="">
<input type="submit" id="real" value="submit"/>
我有试过jquery 1.3没有点击提交按钮。我需要提交最新的$。
Query(function(){
jQuery('.input-text-bx').validate({
expression: "if (VAL) return true; else return false;",
message: "Please enter a valid number"
});
jQuery('.input-text-bx').validate({
expression: "if (VAL.match(/^[0-9]*$/)) return true; else return false;",
message: "Actual card can only be in numbers"
});
jQuery('.input-text-bx').validate({
expression: "if ((VAL.length >=16))return true; else return false;",
message: "The card number should be 16-20 digits"
});
});
(你有没有试过? – Lemurr 2013-03-22 02:47:36
添加了我试过的 – user2194155 2013-03-22 02:55:02
验证何时?在表单上提交,模糊或...? “抛出错误”是什么意思?如果你明确说明什么会被认为是有效的,这可能会更清楚。 “小于20的数字”开放给几种解释。 – nnnnnn 2013-03-22 02:58:45