Jquery验证只能验证表单吗,能验证表单里指定的DIV吗 我现在要在注册页面上用Jquery写个验证,在网上看了好像都是整个表单的验证,我的页面里一个form分三步显示,用DIV分成3个注册步骤(第一个填写结束后点击下一步,验证成功的话,第一个DIV会被隐藏,显示第二个DIV的内容,每个DIV里面是一张表),怎样不提交表单,只验证第一个DIV(步骤一)的内容呢? 步骤一的内容有商家名称,密码,重复密码,email,qq等。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 都在表单中验证,如果是对前两个div的验证,全return false就可以了,第一个div通过,了第二个display设为block,第一个为none,第二个同样只有第三个才检验是否正的通过,通过return true 谢谢1楼的回答先,这是我从jsp页面简化出来的代码,这是form里DIV和table的分布,有点多 <form id="regForm" name="regForm" action="" method="post"> <div id="divStep1" class="PopWindow" > <table class="head_table" width="800" height="498"> <tr style="background-color:#09F; color:#FFF; width:100%;"> <td> <b>商家注册</b> </td> </tr> <tr> <td> <div class="content_div"> <table class="con_table" width="786" height="365"> <tr style=" background-color:#ccecff; color:#FFF; font-weight:bold;"> <td style="text-align:left;"> 步骤1:商家注册 </td> <td style="text-align:right"> 步骤1(共3步) </td> </tr> <tr style=" height:40px; color:red; font-weight:bold;"> <td colspan="2"> 温馨提示:请确保您的必填注册信息真实、全面、有效,否则确认无效的注册信息将被自动删除。 </td> </tr> <tr style=" text-align:left;" class="require" > <td> 请输入贵单位的信息 </td> <td style="text-align:left;" > <span style="color:red;">*</span>必填信息 </td> </tr> <tr> <td colspan="2" style="vertical-align: top;"> <table class="" width="724" > <tr> <td style="width:130px;" class="require"> 商家名称: </td> <td class="require" style="text-align:left"> <input id="ei_CompanyName" type="text" class="underLine" name="t_Base_EnterpriseBaseInfo.ei_CompanyName" size="30" maxlength="100" title="请输入贵企业的名称,最长不能超过50个汉字" /> <span style="color:red">*</span> </td> <td style="width:95px;" class="require"> 商家昵称: </td> <td class="require" style="text-align:left"> <input id="ei_Name" type="text" class="underLine" name="t_Base_EnterpriseBaseInfo.ei_Name" size="20" maxlength="40" title="请输入登录系统的昵称,最长不能超过20个字符" /> <span style="color:red">*</span> </td> </tr> <tr> <td style="width:130px;" class="require"> 商家密码: </td> <td class="require" style="text-align:left"> <input id="ei_Pass" type="password" class="underLine" name="t_Base_EnterpriseBaseInfo.ei_Pass" size="30" maxlength="20" title="请输入登录系统的密码,最长不能超过20个字符" /> <span style="color:red">*</span> </td> </tr> <tr> <td style="width:130px;" class="require"> 确认密码: </td> <td class="require" style="text-align:left"> <input id="ei_Pass1" type="password" class="underLine" size="30" maxlength="20" title="请再次输入登录系统的密码,最长不能超过20个字符" /> <span style="color:red">*</span> </td> </tr> <tr style="height:60px;"> <td colspan="4" align="center"> <input type="button" value="保存进入下一步" style="background-color:blue; color:white; height:30px;" onclick="javascript:showDivStep2();" /> <input type="button" value=" 取消 " style="background-color:blue; color:white; height:30px;" onclick="javascript:window.close();" /> </td> </tr> </table> </td> </tr> </table> </div> </td> </tr> </table> </div> <div id="divStep2" class="PopWindow" style="display:none" > <table class="2_table"> <tr style="background-color:#09F; color:#FFF; width:100%;"> <td> <b>商家注册</b> </td> </tr> <tr> <td> <div class="content_div"> <table class='con_table'> <tr style=" background-color:#ccecff; color:#FFF; font-weight:bold;"> <td style="text-align:left;"> 步骤2:服务协议 </td> <td style="text-align:right"> 步骤2(共3步) </td> </tr> <tr style="height:50px; color:red; font-weight:bold;"> <td colspan="2"> 温馨提示:请详细阅读用户协议。 </td> </tr> <tr style=" text-align:left;" class="require" > <td> 服务协议 </td> <td style="text-align:left;"> <span style="color:red;">*</span>必填信息 </td> </tr> <tr style="height:10px;"> </tr> <tr> <td colspan="2"> <table> <tr> <td style="width:160px; height:300px;" class="noRequire"> 协议<br/>内容 </td> <td class="noRequire" style="text-align:left" colspan="3"> <textarea style=" overflow-x:hidden; width:560px; height:300px;"> 。。协议。。 </textarea> </td> </tr> <tr> <td style="width:100px;" class="require"> 是否同意 </td> <td class="require" style="text-align:left" colspan="3"> <input id="chkAggreement" type="checkbox" value="同意以上协议" checked="checked" onclick="disAggreement();"/> 同意以上协议 </td> </tr> </table> </td> </tr> <tr style="text-align:center;"> <td colspan="4" align="center"> <input id="btnAggreement" type="button" value="同意条款提交注册" onclick="javascript:showDivStep3();" style="background-color:blue; color:white; height:30px;"/> <input type="button" value=" 返回 " onclick = "javascript:showDivStep1();" style="background-color:blue; color:white; height:30px;"/> </td> </tr> </table> </div> </td> </tr> </table> </div> </form> 求高手大大做一个下拉菜单。。。急。。 document输出问题 *******为什么无法调用ActiveX控件?????在线等待! iframe操作另一个iframe,高分在线等 javascript技术问题??? 二级联动分析全过程中的不明白之处,麻烦各位帮我看看!! 請問大家:怎樣才能禁止用戶使用工具欄上一面的功能???謝謝!!! 为什么加了form就不行了!??? sencha touch dataview 滚动事件 关于函数嵌套使用的问题 这段JS的字符在不同版本的IE下支持有问题 窗口大小改变问题
只有第三个才检验是否正的通过,通过return true
<div id="divStep1" class="PopWindow" >
<table class="head_table" width="800" height="498">
<tr style="background-color:#09F; color:#FFF; width:100%;">
<td>
<b>商家注册</b>
</td>
</tr>
<tr>
<td>
<div class="content_div">
<table class="con_table" width="786" height="365">
<tr style=" background-color:#ccecff; color:#FFF; font-weight:bold;">
<td style="text-align:left;">
步骤1:商家注册
</td>
<td style="text-align:right">
步骤1(共3步)
</td>
</tr>
<tr style=" height:40px; color:red; font-weight:bold;">
<td colspan="2">
温馨提示:请确保您的必填注册信息真实、全面、有效,否则确认无效的注册信息将被自动删除。
</td>
</tr>
<tr style=" text-align:left;" class="require" >
<td>
请输入贵单位的信息
</td>
<td style="text-align:left;" >
<span style="color:red;">*</span>必填信息
</td>
</tr>
<tr>
<td colspan="2" style="vertical-align: top;">
<table class="" width="724" >
<tr>
<td style="width:130px;" class="require">
商家名称:
</td>
<td class="require" style="text-align:left">
<input id="ei_CompanyName" type="text" class="underLine" name="t_Base_EnterpriseBaseInfo.ei_CompanyName" size="30" maxlength="100" title="请输入贵企业的名称,最长不能超过50个汉字" />
<span style="color:red">*</span>
</td>
<td style="width:95px;" class="require">
商家昵称:
</td>
<td class="require" style="text-align:left">
<input id="ei_Name" type="text" class="underLine" name="t_Base_EnterpriseBaseInfo.ei_Name" size="20" maxlength="40" title="请输入登录系统的昵称,最长不能超过20个字符" />
<span style="color:red">*</span>
</td>
</tr>
<tr>
<td style="width:130px;" class="require">
商家密码:
</td>
<td class="require" style="text-align:left">
<input id="ei_Pass" type="password" class="underLine" name="t_Base_EnterpriseBaseInfo.ei_Pass" size="30" maxlength="20" title="请输入登录系统的密码,最长不能超过20个字符" />
<span style="color:red">*</span>
</td>
</tr>
<tr>
<td style="width:130px;" class="require">
确认密码:
</td>
<td class="require" style="text-align:left">
<input id="ei_Pass1" type="password" class="underLine" size="30" maxlength="20" title="请再次输入登录系统的密码,最长不能超过20个字符" />
<span style="color:red">*</span>
</td>
</tr>
<tr style="height:60px;">
<td colspan="4" align="center">
<input type="button" value="保存进入下一步" style="background-color:blue; color:white; height:30px;" onclick="javascript:showDivStep2();" />
<input type="button" value=" 取消 " style="background-color:blue; color:white; height:30px;" onclick="javascript:window.close();" />
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</div> <div id="divStep2" class="PopWindow" style="display:none" >
<table class="2_table">
<tr style="background-color:#09F; color:#FFF; width:100%;">
<td>
<b>商家注册</b>
</td>
</tr>
<tr>
<td>
<div class="content_div">
<table class='con_table'>
<tr style=" background-color:#ccecff; color:#FFF; font-weight:bold;">
<td style="text-align:left;">
步骤2:服务协议
</td>
<td style="text-align:right">
步骤2(共3步)
</td>
</tr>
<tr style="height:50px; color:red; font-weight:bold;">
<td colspan="2">
温馨提示:请详细阅读用户协议。
</td>
</tr>
<tr style=" text-align:left;" class="require" >
<td>
服务协议
</td>
<td style="text-align:left;">
<span style="color:red;">*</span>必填信息
</td>
</tr>
<tr style="height:10px;">
</tr>
<tr>
<td colspan="2">
<table>
<tr>
<td style="width:160px; height:300px;" class="noRequire">
协议<br/>内容
</td>
<td class="noRequire" style="text-align:left" colspan="3">
<textarea style=" overflow-x:hidden; width:560px; height:300px;">
。。协议。。
</textarea>
</td>
</tr>
<tr>
<td style="width:100px;" class="require">
是否同意
</td>
<td class="require" style="text-align:left" colspan="3">
<input id="chkAggreement" type="checkbox" value="同意以上协议" checked="checked" onclick="disAggreement();"/> 同意以上协议
</td>
</tr>
</table>
</td>
</tr>
<tr style="text-align:center;">
<td colspan="4" align="center">
<input id="btnAggreement" type="button" value="同意条款提交注册" onclick="javascript:showDivStep3();" style="background-color:blue; color:white; height:30px;"/>
<input type="button" value=" 返回 " onclick = "javascript:showDivStep1();" style="background-color:blue; color:white; height:30px;"/>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</div>
</form>