我有一个注册表格,其中有一些字段要求,用PHP编写的形式,我试图添加一个验证插件,但插件不起作用,我没有得到任何错误。
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js">
</script>
<script src="scripts/jquery.validate.js"></script>
<script>
$(function(){
$("#regForm").validate({
rules: {
brukernavn: {
required: true,
minlength:3,
maxlength:10
},
passord: {
required: true,
minlength:3,
maxlength:10
},
bekreft_pass: {
required: true,
minlength:3,
maxlength:10
},
E_post: {
required: true,
email: true
},
bekreft_epost {
required: true,
email: true
},
messages: {
}
}
});
$.extend($.validator.messages, {
required: "Obligatorisk felt:"
});
});
</script>
<form id="regForm" method="post" action="">
<label for="brukernavn">Brukernavn</label><br>
<input type='text' id="brukernavn" name="brukernavn"><br>
<label for="passord">Passord</label>
<input type="password" id="passord" name="passord"><br>
<label for="bekreft_pass">Bekreft passord</label>
<input type="password" id="bekreft_pass" name="passord2"><br>
<label for="E_post">E-post</label>
<input type="E-post" id="E_post" name="E-post"><br>
<label for="bekreft_epost">Bekreft e-post</label>
<input type="E-post" id="bekreft_epost" name="E-post2"><br>
<br>
<input type='submit' id"submit" value='Register'>
有没有人知道问题出在哪里?
答案 0 :(得分:1)
此处缺少冒号字符:bekreft_epost {
它应为bekreft_epost: {
此外,没有结束表格标签。
答案 1 :(得分:1)