我在同一时间显示验证消息时出现问题。事实上只有一个是表示记录现在:如何使用jquery同时显示复选框验证消息
$('input').bind('click', function(){
var checkboxes_claimType = $("#field-claimType-wrapper").find("input:checked");
if (checkboxes_claimType.length) {
$('#label-claimtype-wrapper label').css('color', 'black');
$('#searchValidationError').hide();
}
else {
$('#label-claimtype-wrapper label').css('color', 'red');
$('#searchValidationError').html('<p>Please select Claim Type</p>');
$('#searchValidationError').show();
}
var checkboxes_claimStatus = $("#field-claimStatus-wrapper").find("input:checked");
if (checkboxes_claimStatus.length) {
$('#label-claimstatus-wrapper label').css('color', 'black');
$('#searchValidationError').hide();
}
else {
$('#label-claimstatus-wrapper label').css('color', 'red');
$('#searchValidationError').html('<p>Please select Claim Status</p>');
$('#searchValidationError').show();
}
});
第一条件的else语句覆盖else语句中的第二个条件是什么来解决这个最好的方法是什么?