2
Where did I go wrong? form test
<script type="text/javascript" >
$(document).ready(function(){
$('#meuForm').validate({
rules:{
nome:{
required: true
},
email:{
required: true
},
telefonefixo:{
required: true
},
celular:{
required: true
}
},
messages:{
nome:{
required: "O campo é obrigatorio."
},
email:{
required: "O campo é obrigatorio."
},
telefonefixo:{
required: "O campo é obrigatorio."
},
celular:{
required: "O campo é obrigatorio."
}
}
});
});
</script>
</head>
<body>
<form name="meuForm" action="" method="POST">
NOME:<br>
<input type="text" name="nome" /><br>
Email:<br>
<input type="text" name="email" /><br>
telefone fixo:<br>
<input type="text" name="telefonefixo" /><br>
Celular:<br>
<input type="text" name="celular" /><br>
<input type="submit" name="Cadastrar" />
</form>
</body>
</html>
yes ultilized in header
<script type="text/javascript" href="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.1.min.js" > </script>
<script type="text/javascript" href="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.9/jquery.validate.min.js" > </script>
You included the jQuery library at the head of the page?
– Luis Henrique
sim ultilizei <script type="text/javascript" href="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.min.js" > </script> <script type="text/javascript" href="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.9/jquery.validate.min.js" > </script script script>
– Jessica Paloma
The @Luishenrique answer is correct. And also be sure to put the references before the question script
– Richard Dias
Don’t forget to set an id to your form, to use the validate, because #meuForm would refer to an id and not its name;
– Rafael Withoeft