2014-09-03 72 views
0

jQuery的验证不工作,我写了像jQuery的验证没有在asp.net工作时,我使用当我使用母版页 母版页

<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> 

回答

1

代码试试这个

$("#aspnetForm").validate({ 
    rules: { 
     <%= tbEmployeeName.UniqueID %>: { 
      required: true 
     } 
    } 
}); 

而且检查此链接

Demo Link

0

w ^呃,就像一个想法。我可以看到你正在使用ASP.NET TextBox。如果它在ASP.NET 4.5中,为什么不使用runat = server的输入?在这种情况下,您将能够使用原始元素ID而不是由ASP.NET生成。