# Getting element properties during initialisation

**URL:** <https://forum.bubble.io/t/getting-element-properties-during-initialisation/360592>\
**Category:** Plugin builders\
**Created:** [February 22, 2025, 5:35am UTC](https://forum.bubble.io/t/getting-element-properties-during-initialisation/360592 "2025-02-22T05:35:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidthorpie](https://avatars.discourse-cdn.com/v4/letter/d/ecccb3/32.png) [@davidthorpie](https://forum.bubble.io/u/davidthorpie)\
**Post date:** [February 22, 2025, 5:35am UTC](https://forum.bubble.io/t/getting-element-properties-during-initialisation/360592/1 "2025-02-22T05:35:52Z")

</div>

Yes, I know this is a bugbear to most plugin developers, and frankly - I’m surprised there isn’t more of an uproar about the lack of this most basic of all basic functions. But I am curious - has anyone worked out a way to achieve this?

I have a plugin that retrieves data, and has a configurable boolean input (dynamic), that determines if the element retrieves data or not. This works fine, EXCEPT on initial page load - where the property is completely ignored, since there is no way to get the value I know of. I currently retrieve that property during the update routine, which only occurs after page load. The way I see it, due to the lack of this capability - I have 4 options and they are all terrible:

1. Change the default (currently false) to true - to allow data retrieval on first load.
2. Create a separate element to handle the true vs. false use case.
3. Use a shared key to determine the global behaviour of the plugin.
4. Create some REALLY hacky solution that somehow causes the update routine to run immediately after the initialisation, to force the properties to be retrieved.

As above, I agree these are all terrible options - but without this most basic functionality, I am really lost in terms of how to achieve this…

---

<div class="post-metadata">

**Author:** ![ihsanzainal84](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/ihsanzainal84/32/245932_2.png) [@ihsanzainal84](https://forum.bubble.io/u/ihsanzainal84)\
**Post date:** [February 22, 2025, 11:17am UTC](https://forum.bubble.io/t/getting-element-properties-during-initialisation/360592/2 "2025-02-22T11:17:39Z")

</div>

Hmm…doesn’t an update run after the initialization? That’s been my experience

---

<div class="post-metadata">

**Author:** ![davidthorpie](https://avatars.discourse-cdn.com/v4/letter/d/ecccb3/32.png) [@davidthorpie](https://forum.bubble.io/u/davidthorpie)\
**Post date:** [February 22, 2025, 12:54pm UTC](https://forum.bubble.io/t/getting-element-properties-during-initialisation/360592/3 "2025-02-22T12:54:29Z")

</div>

Have just tested this, and you are indeed correct, and it helped me narrow down the cause a bit further. I’ve been fighting an issue for days, where no matter what I did I could not get the properties to read. Just goes to show - sometimes it takes going back to basics!

Turns out it was a syntax error that was apparently silently causing a block of code to not run. Nothing worse than a silent error…

---

<div class="post-metadata">

**Author:** ![ihsanzainal84](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/ihsanzainal84/32/245932_2.png) [@ihsanzainal84](https://forum.bubble.io/u/ihsanzainal84)\
**Post date:** [February 22, 2025, 1:47pm UTC](https://forum.bubble.io/t/getting-element-properties-during-initialisation/360592/4 "2025-02-22T13:47:57Z")

</div>

Oh man. Syntax errors giving me PTSD.

---

<div class="post-metadata">

**Author:** ![jonah.deleseleuc](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/jonah.deleseleuc/32/199133_2.png) [@jonah.deleseleuc](https://forum.bubble.io/u/jonah.deleseleuc)\
**Post date:** [February 22, 2025, 5:08pm UTC](https://forum.bubble.io/t/getting-element-properties-during-initialisation/360592/5 "2025-02-22T17:08:31Z")

</div>

Initialization runs one time when the element first becomes visible. Update runs whenever `properties` changes.

Tip:  
`initialize: instance.data.i = 0 `

`update: if(instance.data.i === 0){ instance.data.i++ //run code here }`

This will save you a headache
