0
如果父td中的每个.itemToFilter子元都未通过测试(因此返回所有TRUE),则应执行alert('hello world')。但它不是!jQuery:遍历子元素和布尔值
第一个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');
}
});
请提供HTML源 – ianace