如何使用jQuery删除空间并限制特殊字符? [英] How to remove space and restrict special chars using jquery?
本文介绍了如何使用jQuery删除空间并限制特殊字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在网站上创建注册表格.我想用用户名
I am creating a signup form in my website. I want to implement some checkup with username, which are
- 用户名不能有空格,
- 用户名不能包含除点(.)以外的任何特殊字符,例如gmail以其注册形式进行的操作.
我在我的应用程序中使用jQUERY,谁能告诉我如何使用jquery来实现上面列出的两次检查?我还记得用户名的这两个主要检查,请提出建议,如果您还知道其他任何内容?
I am using jQUERY in my app, can anyone tell me how to implement above listed two checkups using jquery ?? I remember these two main checkups for username please suggest if you knows any other?
谢谢
推荐答案
I tried out following jquery script by studying the links (this one) given by @Dror to check for wrong characters in username,
if (!$('#uname').val().match("^[a-z0-9'.\s]{1,50}$")) {
//not a correct username
}
谢谢
这篇关于如何使用jQuery删除空间并限制特殊字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文