[英]Using jQuery to check for regular expressions
I know there's the jQuery validation plugin. 我知道有jQuery验证插件。 But I don't need something that extensive.
但是我不需要那么广泛的东西。
All I want to do is have jQuery check a name text box: 我要做的就是让jQuery检查名称文本框:
<input type="text" name="name" id="name" />
To make sure that it has at least 2 characters 确保它至少包含2个字符
AND 和
I want jQuery to check a phone text box (identical to the name text box, name="phone" and id="phone"), to make sure that it only contains numbers, doesn't matter how many numbers. 我希望jQuery检查一个电话文本框(与名称文本框相同,即name =“ phone”和id =“ phone”),以确保它仅包含数字,与多少个数字无关。
Finally, and this is only if this is not too hard to accomplish, I want jQuery to validate the email address to check and make sure that it has the character '@' in it. 最后,只有在这不太难实现的情况下,我希望jQuery验证电子邮件地址以进行检查并确保其中包含字符'@'。
Is this too hard to do? 这太难了吗?
Thanks, Amit 谢谢阿米特
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.