Então galera, eu estou usando uma biblioteca do jQuery para validar um form, porem quando eu coloco o script JavaScript em outro arquivo o método não funciona. Se eu colocar o Script no mesmo arquivo, abaixo do form ele roda.
Esse é o form:
<html> <head> <script src="C:\wamp\www\SiteAulas\validateForm.js"></script> </head> <body> <form name="cadastrar" id="cadastro" method="post" action="test.php"> <table width="400px" border="0" cellspacing="0" cellpadding="0"> <tr height=60px> <td><label for="nome" class="form1">Nome:</label></td> <td><input name="nome" type=text required id="nome" maxlength="15"></td> </tr> <tr height=60px> <td><label for="sobrenome" class="form1">Sobrenome:</label></td> <td><input name="sobrenome" type=text required id="sobrenome" maxlength="30"></td> </tr> <tr height=60px> <td><label for="email" class="form1">E-mail:</label></td> <td><input name="email" type=text required id="email" maxlength="60"></td> </tr> <tr height=60px> <td><label for="senha1" class="form1">Senha:</label></td> <td><input name="senha" type="password" required id="senha" maxlength="15"></td> </tr> <tr height=60px> <td><label for="repetirSenha" class="form1">Repetir Senha:</label></td> <td><input name="repetirSenha" type="password" required id="repetirSenha" maxlength="15"></td> <td><input name="enviar" type="submit" id="enviar"></td> </tr> </body> </html>
e esse é o JavaScript:
<html> <head> <script src="C:\wamp\www\Bibliotecas\jquery-2.1.4\jquery-2.1.4.js"></script> <script src="C:\wamp\www\Bibliotecas\jquery-validation-1.14.0\dist\jquery.validate.js"></script> $("#cadastro").validate({ rules: { senha: { minlength: 6 }, repetirSenha: { required: true, minlength: 6, equalTo: "#senha" } }, messages: { senha: { minlength: "</br>Sua senha deve ter no minimo 6 caracteres." }, repetirSenha: { minlength: "</br>Sua senha deve ter no minimo 6 caracteres.", equalTo: "</br>Esse campo deve ser igual a senha" } } }); </head> <body> </body> </html>
Eu estou esquecendo de alguma coisa??