0
我寫這個腳本正好在我的HTML代碼下,因爲我想驗證我的表單與插件「jQuery.validate.js」,但它根本不工作。我在視頻教程中看到它,但它不工作,我正在工作,從2天開始做R & D,但都是徒勞的。由於我是JavaScript和jQuery中的一個核心,所以請發佈一些有用的材料。表單驗證與jquery不工作
<script type="text/javascript">
$(document).ready(function(){
$('#sign_up').validate(function(){
rules: {
first_name: "required",
last_name: "required",
user_name: "required",
father_name: "required",
guardian_name: "required",
cnic_no: "required",
mob_num: "required",
ofic_no: "required",
res_no: "required",
b_day: "required",
home_address: "required",
office_address: "required",
my_country: "required",
my_city: "required",
radio_gender: "required",
radio_status: "required",
email: {
required: true,
email: true
}
},
// Specify the validation error messages
messages: {
first_name: "Please enter your first name",
last_name: "Please enter your last name",
user_name: "Please enter your user name",
father_name: "Please enter your father name",
guardian_name: "Please enter your guardian name",
cnic_no: "Please enter your cnic",
mob_num: "Please enter your mobile number",
ofic_no: "Please enter your office number",
res_no: "Please enter your residantial no",
b_day: "Please enter your birth date",
home_address: "Please enter your home address",
office_address: "Please enter your office address",
my_country: "Please enter your country",
my_city: "Please enter your city",
radio_gender: "Please select your gender",
radio_status: "Please select your status",
email: "Please enter a valid email address",
}
});
});
</script>
究竟如何在不工作?控制檯中有任何錯誤? – phts
你的表單HTML在哪裏? –
其實親愛的它很長,它可能會讓你感到困惑這就是爲什麼我該死的寫在這裏 –