I am having trouble getting this jQuery script to function:
$(document).on('knack-scene-render.scene_126', function() {
$('#view_498 > div.kn-list-content.columns.is-multiline').each(function(index) {
if ($(this).eq(index).find('.field_744 .kn-detail-body').text().length > 0) {
$(this).eq(index).find('.field_396 .kn-detail-body').css('background-color','#ffff00');
}
});
});
The goal is to search each div group under "#view_498 > div.kn-list-content.columns.is-multiline" to see if the text value of '.field_744 .kn-detail-body' is not empty, if it's not empty, then it puts a yellow highlight on '.field_396 .kn-detail-body' in that respective div. The problem I'm having is every single '.field_396 .kn-detail-body' in all divs under the parent are being highlighted, even if there is no text in field_744 of that respective div.
What am I doing wrong?