私の現在の声明:
if (recaptcha == '' || name == '' || email == '' || emailCheck || emailVerify || priority == 'pap' || topic == 'pat' || message == 'message') {
$('#incorrmsg').html("Please fill in the fields").slideDown("slow");
} else {
//else statemnt goes here
}
これに関する問題は、これを 1 つの ID でしか実行できないことです。
私はそれをこのステートメントに変更したい:
if (name == '') {
$('#incorrname').html("Please fill in your name").slideDown("slow");
}
if (email == '' || emailCheck || emailVerify) {
$('#incorremail').html("Please fill in and verify your email").slideDown("slow");
}
if (priority == 'pap') {
$('#incorrpri').html("Please pick a priority").slideDown("slow");
}
if (topic == 'pat') {
$('#incorrtop').html("Please pick a topic").slideDown("slow");
}
if (message == 'message') {
$('#incorrmess').html("Please type in your message").slideDown("slow");
} else {
//else statemnt goes here
}
フィールドにエラーがある場合、すべてのメッセージを同時に表示したい。つまり、ステートメント
を使用したくないということです。else if
それで、私は何をしますか?