[Solved] Image icon/tag showing although dataset field is empty

Hi Helena:

I think Tiaan’s proposal is a good one.

In case you are also interested in understanding why your code isn’t working here is some feedback:

$w("#repeater1").onItemReady( ($w, itemData, index) => { 
    console.log(itemData.image2);
    if(itemData.image2 === "null") { 
        $w("#image25").hide(); 
   } else {
       $w("#image25").show();
   }
 });

the value null is not a string it is an actual javascript primitive value representing the absence of a value.
Check out this link: null - JavaScript | MDN

The simple way to test for null is to use the not operator - !. The other way is to reverse the logic so instead of testing for the absence of a value, test for its existence. I would also make sure that the image2 name has a length > some expected minimal value (at a minimum > 0 ). So you could change your code to be as follows

$w("#repeater1").onItemReady( ($w, itemData, index) => {
      console.log(itemData.image2);
      // Note I have reversed the logic to make the code easier to read
      if(itemData.image2 && itemData.image2.length > 0) {
          $w("#image25").show();
     } else { 
          $w("#image25").hide();
     }
});

Hope this is helpful.