# How can I run code after the items have loaded on my page? Is there a callback I can use?

**URL:** <https://forum.finsweet.com/t/how-can-i-run-code-after-the-items-have-loaded-on-my-page-is-there-a-callback-i-can-use/74>\
**Category:** Attributes\
**Tags:** attributes-api\
**Created:** [April 18, 2023, 9:40pm UTC](https://forum.finsweet.com/t/how-can-i-run-code-after-the-items-have-loaded-on-my-page-is-there-a-callback-i-can-use/74 "2023-04-18T21:40:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Support-Luis](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.finsweet.com/support-luis/32/53_2.png) [@Support-Luis](https://forum.finsweet.com/u/Support-Luis)\
**Post date:** [April 18, 2023, 9:40pm UTC](https://forum.finsweet.com/t/how-can-i-run-code-after-the-items-have-loaded-on-my-page-is-there-a-callback-i-can-use/74/1 "2023-04-18T21:40:46Z")

</div>

You can use the Attributes API to:

- Add JavaScript to Attributes solutions.
- Add custom functionality to Attributes when the default no-code functionality does not satisfy the use case.
- Integrate third-party JavaScript libraries with Attributes solutions.
- Integrate third-party data (data outside of Webflow CMS) with Attributes solutions.
- Programmatically set custom values to filters, search, range sliders, etc.
- Listen for events such as “renderitems”, “switchpage”, etc, to trigger custom actions when desired.

Here is the callback to CMS Load, read the docs here: [**Attributes API Documentation**](https://finsweet.com/attributes/api)

```auto
window.fsAttributes = window.fsAttributes || [];
window.fsAttributes.push([
  'cmsload',
  (listInstances) => {
    console.log('cmsload Successfully loaded!');

    // The callback passes a `listInstances` array with all the `CMSList` instances on the page.
    const [listInstance] = listInstances;

    // The `renderitems` event runs whenever the list renders items after switching pages.
    listInstance.on('renderitems', (renderedItems) => {
      console.log(renderedItems);

    });
  },
]);

```

---

<div class="post-metadata">

**Author:** ![Brutus](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.finsweet.com/brutus/32/194_2.png) [@Brutus](https://forum.finsweet.com/u/Brutus)\
**Post date:** [May 5, 2023, 2:00pm UTC](https://forum.finsweet.com/t/how-can-i-run-code-after-the-items-have-loaded-on-my-page-is-there-a-callback-i-can-use/74/2 "2023-05-05T14:00:10Z")

</div>

I understand this to mean that we can use this code snippet in the same way we would use a Webflow.push function or a DOMContentLoaded event listener, but this is solely for attributes scripts loading as they are async? Is this correct?

Thanks
