jquery.validate 两个form验证的时候第一个不好用,请教!
<%@PageLanguage="C#"AutoEventWireup="true"CodeFile="Default.aspx.cs"Inherits="_Defaul...
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>无标题页</title>
<script type="text/javascript" src="jquery-validation-1.8.1/lib/jquery.js"></script>
<script type="text/javascript" src="jquery-validation-1.8.1/jquery.validate.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#form_1").validate();
$("#form_2").validate();
});
</script>
</head>
<body runat="server">
<form id="form1" runat="server">
<table>
<tr>
<td>
<form id="form_2" action="">
<asp:TextBox ID="TextBox2" runat="server" class="required"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Button" />
</form>
</td>
<td>
<form id="form_1" action="">
<asp:TextBox ID="TextBox1" runat="server" class="required"></asp:TextBox>
<asp:Button ID="Button2" runat="server" Text="Button" />
</form>
</td>
</tr>
</table>
</form>
</body>
</html>
上面的textbox2的验证就不好用 展开
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>无标题页</title>
<script type="text/javascript" src="jquery-validation-1.8.1/lib/jquery.js"></script>
<script type="text/javascript" src="jquery-validation-1.8.1/jquery.validate.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#form_1").validate();
$("#form_2").validate();
});
</script>
</head>
<body runat="server">
<form id="form1" runat="server">
<table>
<tr>
<td>
<form id="form_2" action="">
<asp:TextBox ID="TextBox2" runat="server" class="required"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Button" />
</form>
</td>
<td>
<form id="form_1" action="">
<asp:TextBox ID="TextBox1" runat="server" class="required"></asp:TextBox>
<asp:Button ID="Button2" runat="server" Text="Button" />
</form>
</td>
</tr>
</table>
</form>
</body>
</html>
上面的textbox2的验证就不好用 展开
2个回答
展开全部
验证条件呢?
<input type="text" maxlength="10" minlength="6" / >
<input type="text" maxlength="10" minlength="6" / >
追问
maxlength="10" minlength="6" 这不就是验证条件吗
追答
1 你这段代码有问题
这里边再套 不符合规矩
2 class="{required:true,minlength:5,equalTo:'#password'}"
当使用了class作为条件函数则必须引用
jquery.metadata.js 这个文件
解决这2个问题后再试试
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询