我想使用jquery对确认密码进行验证 [英] I wanted to do validation on confirm password using jquery

查看:141
本文介绍了我想使用jquery对确认密码进行验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨......

我想使用jquery对确认密码进行验证。我做了但是没有工作。

我告诉你我的代码。请让我们我知道这个错误是什么..

$(文件).ready(function(){

$(#form1).validate(

{

规则:

{



<%= txtpass.UniqueID%>:< br $>
{

required:true,

minlength:4,

maxlength:10



},

<%= txtRepass.UniqueID%>:

{

required:true ,

minlength:4,

maxlength:10,

等于:#txtpass;



}









},

消息s:

{





<%= txtpass.UniqueID>:

{

必填:最少4个字符





},



<%= txtRepass.UniqueID>:

{

required:确认密码与给定密码不匹配





}



}

});

});

Hi...
I wanted to do validation on confirm password using jquery.I did but that is not woking.
I show you my code.Please let me know what the error in this..
$(document).ready(function () {
$(#form1).validate(
{
rules:
{

<%=txtpass.UniqueID %>:
{
required: true,
minlength: 4,
maxlength:10

},
<%=txtRepass.UniqueID %>:
{
required: true,
minlength: 4,
maxlength: 10,
equalto: "#txtpass";

}




},
messages:
{


<%=txtpass.UniqueID >:
{
required: "Minimum 4 characters"


},

<%=txtRepass.UniqueID>:
{
required: "Confirm password does not match given password earlie"


}

}
});
});

推荐答案

(文件).ready(function(){
(document).ready(function () {

< br>

(#form1).validate(

{

规则:

{



<%= txtpass.UniqueID%>:

{

required:true,

minlength:4 ,

maxlength:1 0



},

<%= txtRepass.UniqueID%>:

{

必需:true,

minlength:4,

maxlength:10,

等于:#txtpass;



}









},

消息:

{





<%= txtpass.UniqueID>:

{

required:""最少4个字符"





},



<%= txtRepass.UniqueID>:

{

required:确认密码与给定密码不匹配





}



}

});

});
(#form1).validate(
{
rules:
{

<%=txtpass.UniqueID %>:
{
required: true,
minlength: 4,
maxlength:10

},
<%=txtRepass.UniqueID %>:
{
required: true,
minlength: 4,
maxlength: 10,
equalto: "#txtpass";

}




},
messages:
{


<%=txtpass.UniqueID >:
{
required: "Minimum 4 characters"


},

<%=txtRepass.UniqueID>:
{
required: "Confirm password does not match given password earlie"


}

}
});
});


你的代码是一些Javascript,即客户端代码。验证客户端密码这样的东西会破坏使用密码的全部目的。您提到过ASP.NET,但问题与ASP.NET或任何服务器端技术无关。实际上,如果不涉及服务器端,则认证没有任何意义。所以,这个问题根本没有意义。



在开发任何东西之前,你真的需要熟悉关于Web如何工作的一般想法。



-SA
You "code" is some Javascript, that is, client-side code. Validation such thing as password on client side defeats the whole purpose of using password. You mentioned ASP.NET, but the question is not related to ASP.NET or any server-side technology. Actually, authentication does not make any sense if server side is not involved. So, this question simply makes no sense.

Before developing anything, you really, really need to get familiar with general ideas on how Web works.

—SA


这篇关于我想使用jquery对确认密码进行验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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