我有以下代码来执行下面显示的SubmitForm验证。当我单击AddressListing div标记并调用验证函数时,它仅对businessname字段执行验证,但不对其他剩余feilds.Only商业名称字段将以红色突出显示,但不会显示其他行为。我使用下面的jQuery插件验证领域http://jquery.bassistance.de/validate/jquery.validate.js使用jquery validate插件进行表单验证的问题
example.html的
<fieldset id="fieldset1"> <legend>Registration Details:</legend>
<form id="SubmitForm">
Name of business:<br/>
<input size="30" type="text" id="businessname" class="required" /><br/>
Zipcode:<br>
<input size="30" type="text" id="zipcode" class="required zipcode"/><br>
Telephone:<br/>
<input size="30" type="text" id="telephone" class="required phone" /><br/>
Email:<br/>
<input size="30" type="text" id="email" class="required email"/>
</fieldset>
<br/>
Your email is your User Name:<br/>
<input size="30" type="text" id="username" class="required"/><br/>
Choose Password:<br/>
<input size="30" type="text" id="pass" class="required password" class="required"/><br/>
Retype Password:<br/>
<input size="30" type="text" id="pass1" equalTo="#pass"/><br/>
<input id="Addresslisting" type="image" src="images/Submit.png" align="left" />
</form>
</feildset>
Example.js
$(document).ready(function() {
$("#Addresslisting").click(function() {
$("#addresslistingform").validate();
});
});
Example.css
label { width: 10em; float: left; }
label.error {
color: red; padding:8px 200px 0px 0px; vertical-align: top; float:right;
background:url("unchecked.gif") no-repeat 120px 0px;
}
input.error {border:1px solid red;}
input.errorlist {margin:0; color: red; margin-bottom:10px;}
#fieldset1
{
border: 1px solid #1f76c8;
width: 500px;
margin:5px;
padding:10px 15px 5px 15px;
}
我的表单的Id是SubmitForm我怎么能写submitForm,S和F都在大写 – mahesh 2010-10-07 11:38:29
错误...所以我的代码示例。你尝试过其中之一吗? – Gazler 2010-10-07 11:41:03
对不起,谢谢你的答复,这实际上是我的错误 – mahesh 2010-10-07 11:44:42