{Solved} Collapsing empty image fields in a repeater. Help please

hello,
kindly help me with collapsing the empty image fields nested in a repeater as not allI of the displayed items have images hence I am left with a big blank area in the repeater. i have been trying for two days and i have also checked the forum and the corvid tutorial of hiding a video field here
https://support.wix.com/en/article/corvid-tutorial-hiding-a-video-player-when-there-is-no-video-to-play

my code is below:

$w.onReady(() => {
$w(“#dataset7”).onReady(() => {
// Gets the current item properties and stores them in a variable called item
const item = $w(“#dataset7”).getCurrentItem();
// Checks if the current item has a value in the “postImage” field
if (!item.postImage) {
// Collapses the image if there is no value for “postImage”
$w(“#image5”).collapse();
}
});
});

thanx in advance

Have a look at Repeater in the API Reference as you will need it to apply to an individual item in the repeater and not just all items.
https://www.wix.com/corvid/reference/$w.Repeater.html

thank you for your input @givemeawhisky however, I am still at a standstill. please check my code and correct me if you can

here is my new code

$w.onReady( function () {
//TODO: write your page related code here…
$w(“#repeater1”).onItemReady(($w, itemData, index) =>{
if (!itemData.postimage) {
$w(“#Image5”).collapse();
}
});

i hope you reply soon

Hello, Can anyone please check my code and help me?

instead of $w(" #repeater1 “).onItemReady(($ w , itemData, index) =>{
use:
$w(” #repeater1 “).onItemReady(( $item , itemData, index) =>{
instead of: $ w (”#Image5").collapse(); use $ item (“#Image5”).collapse();
and you’re missing }) in the end of your code

Thank you soo much. I cannot thank you enough. i spent so much time on this.
regards.