ボタンをクリックすると、セットが選択されず、チェックボックスが選択されていない場合、アラートウィンドウには両方のメッセージが表示されますが、現時点では最初に "すべてのボックスをチェックしてください"というメッセージが表示されます。何が間違っていますか、ありがとう!アラートが完全に表示されない
$('#movetoset').click(function() {
var fail = "";
if ($('#selectsett').val() === 'General') {
fail = "Please chooose a set.\n";
}
for (j = 0; j < array_str_idnum.length; j++) {
if (document.getElementById('check' + array_str_idnum[j]).checked) {
document.getElementById('imagediv' + array_str_idnum[j]).style.display = 'none';
// (Add to database here?)
array_str_idnum[j] = 'flag_gone'; // for example
}
if (document.getElementById('check' + array_str_idnum[j]).checked == false) {
fail = "Please check all the box.\n";
}
}
flag = false;
for (j = 0; j < array_str_idnum.length; j++) {
if (array_str_idnum[j] == 'flag_gone') {
flag = flag && true;
}
else {
flag = false
}
}
if (flag == true) {
$('#steptwo').hide();
$('#begin').fadeIn();
}
if (fail == "") {
return true;
} else {
alert(fail);
return false;
}
});
おかげで、助けを解決し、感謝! – tony
いいえ汗::) –