Change gallery item descriptions with javascript code

Hi,
I want to change the description of some items in the gallery after it is populated from a dataset. Here #gallery1 gets its data from #dataset1. I’m trying to iterate through the pictures and change the description text.

This was my attempt:
$w.onReady( () => {
  $w("#dataset1").onReady( () => {
 var item
 for (item in $w("#gallery1").items){
 if (item.description === "0") {
        item.tile = "POA"
      }
    }
  } );
} );

what is item.tile ?

1 Like

it is pulled from a database, it is connected to the price of products in the products database.

I just figured it out! Thank you for writing me back. Please review the new code below see if there’s a more efficient way of writing it.

For any poor soul who is banging their head on their keyboard, this is how you update something in a gallery after it loads from a dataset.

$w.onReady(function () {
    $w('#dataset1').onReady(() => {
 let items = $w('#gallery1').items

 for (let item of items){
 if (item.description === '0'){
                item.description = 'POA'
 let itemNew = item
                items.pop(item)
                items.push(itemNew)
            }
        }
        $w('#gallery1').items = items;
    })
})