如果父 td 中的每个 .itemToFilter 子项都未通过测试(因此返回全部 TRUE),则应该执行 alert('hello world')。但事实并非如此!
第一个 IF 语句工作正常,我已经用警报对其进行了测试。但不是第二个。
var businessTypePullDownValue = $('.businessTypePullDown').val();
$('.businessTypeRow td').each( function() {
var foundOne = $(this).children('.itemToFilter').each( function() {
if(($(this).attr('value') == businessTypePullDownValue)) {
return true;
}
});
if(!foundOne) {
alert('hello world');
}
});