简体   繁体   中英

Using jQuery to check for regular expressions

I know there's the jQuery validation plugin. But I don't need something that extensive.

All I want to do is have jQuery check a name text box:

<input type="text" name="name" id="name" />

To make sure that it has at least 2 characters

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.

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.

Is this too hard to do?

Thanks, Amit

如果jQuery验证插件过于广泛,这是一个更简单的插件

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM