我有一个注册表单,其中包含用 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'>
有谁看到问题出在哪里?