使用JQuery进行表单验证以显示工具提示 [英] Form Validation using JQuery to display ToolTip
本文介绍了使用JQuery进行表单验证以显示工具提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用包含许多控件的注册"表单.我想验证那些控件,例如不能留空,电子邮件验证,数字输入等.
现在,我正在为此使用JavaScript警报框,但是我想显示一种吸引人的方式来显示错误的工具提示.
我正在使用以下代码
I am working with a Registration form containing lots of controls. I want to validate those controls like can''t left as blank, email validation, Numeric input etc etc.
Now I am using JavaScript alert Box for that, but I want to display a tooltip like attractive way to display the error.
I am using the following code
<script type='text/javascript'>
function notEmpty(elem, helperMsg){
if(elem.value.length == 0){
alert(helperMsg);
elem.focus();
return false;
}
return true;
}
</script>
<form>
Required Field: <input type='text' id='req1'/>
<input type='button'
önclick="notEmpty(document.getElementById('req1'), 'Please Enter a Value')"
value='Check Field' />
</form>
请帮助我.
please help me.
推荐答案
检查一下
http://www.position-absolute.com /articles/jquery-form-validator-because-form-validation-is-a-mess/ [ http://www.position-relative.net/creation/formValidator/demos/demoValidators.html [^ ]
Check this out
http://www.position-absolute.com/articles/jquery-form-validator-because-form-validation-is-a-mess/[^]
http://www.position-relative.net/creation/formValidator/demos/demoValidators.html[^]
这篇关于使用JQuery进行表单验证以显示工具提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文