> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# Method name: onItemReady(handler: ItemReadyEventHandler)

# Method package: w

# Method menu location: w --> Repeater --> onItemReady

# Method Link: https://dev.wix.com/docs/velo/velo-only-apis/$w/repeater/on-item-ready.md

# Method Description:

Sets the function that runs when a new repeated item is created.

Use the `onItemReady()` function for code you want to run before new
 repeated items are rendered. 

 The `onItemReady()` function can be added as a static event handler using the Properties & Events Panel, or as a dynamic event handler using the `$w` selector. 

> **Note:** When calling this function, make sure to call it only once, and only in the page's `onReady()` function.

 The callback is triggered when you add new items by setting the
 [`data`](#data) property or when new items are created based on a
 dataset that is connected to the repeater. It is not triggered for
 existing items that are updated when you set the [`data`](#data)
 property. (For more information about when new items are created, see
 the `data` property.) To run code after updating existing items, use
 the [`forEachItem`](#forEachItem) or [`forItems`](#forItems) functions
 instead.

 Because setting a repeater's `data` property triggers the `onItemReady()`
 callback to run, make sure you call `onItemReady()` before you set the
 `data` property. Failing to do so will mean that your callbacks are not
 triggered when you set the `data` property.

 Usually, you use `onItemReady()` to:

 + Apply the repeated item's `itemData` to the properties and functions
   of the repeated elements contained in the repeated item being created.

   For example, you can use `onItemReady()` to set the [`src`](https://dev.wix.com/docs/velo/velo-only-apis/$w/image/src.md)
   property of an image in the repeater to an image source found in the `itemData`
   object and then [`show()`](https://dev.wix.com/docs/velo/velo-only-apis/$w/image/show.md) the image.
 + Add event handlers to the repeated elements contained in
   the repeated item being created.

   For example, you can use `onItemReady()` to set the [`onClick()`](/$w/button/on-click)
   event handler of a button in the repeater.

> **Note:** When using a dataset to populate the contents of your repeated items,
  the `onItemReady()` callback function is triggered before the dataset
  populates the values of your page elements. Therefore, element values
  that you set using `onItemReady()` may be overridden when the dataset is
  ready. To change the values set by the dataset, use [`forEachItem`](#forEachItem)
  inside the dataset's [`onReady()`](https://dev.wix.com/docs/velo/api-reference/$w/dataset/on-ready.md). For more
  information, see the [`forEachItem`](#forEachItem) examples.



# Method Code Examples:

*** Note: do not assume any prop names or enum values other than the ones in the example.

## Set up new repeated items

```javascript
$w("#myRepeater").onItemReady( ($item, itemData, index) => {
  let repeatedElement = $item("#repeatedElement");
  let nonRepeatedElement = $w("#nonRepeatedElement");
  let itemDataValue = itemData.someProperty;
  let isEvenItem = index % 2 === 0;
});
```

## Populate a repeater using static data

```javascript
// Static array of objects, each containing a unique `_id` value
const staticData = [
  {_id: '1', language: 'English', greeting: 'Hello World!'},
  {_id: '2', language: 'French', greeting: 'Bonjour monde!'},
  {_id: '3', language: 'Japanese', greeting: 'こんにちは世界！'},
  {_id: '4', language: 'Portuguese', greeting: 'Olá Mundo!'},
  {_id: '5', language: 'Spanish', greeting: '¡Hola Mundo!'},
  {_id: '6', language: 'Ukrainian', greeting: 'Привіт Світ!'}
];

$w.onReady(async function () {
  // Define how to set up each new repeater item
  $w('#helloRepeater').forEachItem( ($item, itemData, index) => {
    $item('#languageText').text = itemData.language;
    $item('#helloText').text = itemData.greeting;
    $item('#indexText').text = (index + 1).toString();

    $item('#itemContainer').onMouseIn( () => {
      $item('#languageText').show();
    });

    $item('#itemContainer').onMouseOut( () => {
      $item('#languageText').hide();
    });
  } );

  console.log(staticData);

  // Set the data to associate with the repeater
  $w('#helloRepeater').data = staticData;
});

```

---