jquery验证无效 我写了像
这样的代码<script src="../script/jquery-1.3.2.js" type="text/javascript"></script>
<script src="../script/jquery-latest.js" type="text/javascript"></script>
<script src="../script/jquery.validate.js" type="text/javascript"></script>
<script type="text/jscript">
$(document).ready(function() {
$("#aspnetForm").validate({
rules: {
ctl00$tcAccounts$tpnlChangePassword$tbEmployeeName: {
required: true
},
ctl00$tcAccounts$tpnlChangePassword$tbEmployeeMailId: {
required: true
}
},
messages: {
ctl00$tcAccounts$tpnlChangePassword$tbEmployeeName: {
required: "specify email"
},
ctl00$tcAccounts$tpnlChangePassword$tbEmployeeMailId: {
required: "specify password"
}
}
});
});
</script>
答案 0 :(得分:0)
试试这个
$("#aspnetForm").validate({
rules: {
<%= tbEmployeeName.UniqueID %>: {
required: true
}
}
});
同时查看此链接
答案 1 :(得分:0)
嗯,就像一个想法。我可以看到你正在使用ASP.NET TextBox。如果是在ASP.NET 4.5中,为什么不使用runat = server输入?在这种情况下,您将能够使用原始元素ID而不是由ASP.NET生成。