在我的HTML页面中,我使用Live Validation library
我的问题是,当我输入正确的值时,库显示“不匹配!”当我清除所有输入时,它会正确验证。这是我的代码示例:
<script type="text/javascript" src="resources/jquery/livevalidation.js"></script>
<p>
<label for="password">Password</label>
<form:password id="password" path="password" tabindex="4" />
</p>
<p>
<label for="password">Confirm Password</label>
<form:password id="conformPassword" path="conformPassword" tabindex="5" />
</p>
-----
<script>
$(document).ready(function(){
ValidCaptcha();
});
</script>
<script type="text/javascript">
function ValidCaptcha() {
var password1 = new LiveValidation('conformPassword');
password1.add( Validate.Confirmation, { match: 'password' } );
}
</script>
这里出了什么问题?
答案 0 :(得分:0)
我根据你的代码制作了这个例子....它正在运行btw:
<html>
<head>
<script type="text/javascript" src="http://livevalidation.com/javascripts/src/1.3/livevalidation_standalone.compressed.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript">
function ValidCaptcha() {
var password1 = new LiveValidation('conformPassword');
password1.add( Validate.Confirmation, { match: 'password' } );
}
$(document).ready(function() {
ValidCaptcha();
});
</script>
</head>
<body >
<p>
<label for="password">Password</label>
<input type="password" id="password" tabindex="4" />
</p>
<p>
<label for="password">Confirm Password</label>
<input type="password" id="conformPassword" tabindex="5" />
</p>
-----
</body>
</html>
在我的localhost上测试过;我改变了javascript的顺序。
Saludos;)