我应该如何提供java脚本验证来验证文本框中的名称 [英] How should I provide a java script validation to validate name in a textbox

查看:67
本文介绍了我应该如何提供java脚本验证来验证文本框中的名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将javascript验证写入允许的文本框,

只有字母,

没有数字,

没有特殊符号,

单词之间只有一个空格,

没有第一个字符作为空格。



考试:

名字为ram kumar sripada



单词和strating字母之间只有一个空格应该是字母

How to write a javascript validation to a textbox which allows,
only alphabets,
no numeric,
no special symbols,
only one space between words,
no first char as space.

for exam:
name as ram kumar sripada

only one space between words and strating letter should be alphabet

推荐答案

使用 jQuery [ jQuery Validation Plugin [ ^ ] title =New Window> ^ ]轻松添加验证码...

对于您的确切规则使用regexp ...
Use jQuery[^] with jQuery Validation Plugin[^] for easily add validation code...
For your exact rule use regexp...


5月这个帮助你





May this Help You


<input type = "text" id = "txtState" />
<input type = "button" id = "btnValidate" value = "Submit" />







<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">


#btnValidate)。live( 点击 function (){
var regex = / ^ [a-zA-Z] *
("#btnValidate").live("click", function () { var regex = /^[a-zA-Z ]*


这篇关于我应该如何提供java脚本验证来验证文本框中的名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆