Code snippets
How to Wait for Dynamically Loaded Elements in an A/B Test
★★★ Technical level 3 of 3
Written by Neil Webley · Last updated
Poll for late-rendered elements before changing them.
What you need to know
Replace the Poll For Element placeholder with a unique selector. The supplied interval checks every 100 milliseconds and clears after finding a match.
How to use it safely
Add a maximum duration so polling cannot run forever. Decide whether later rerenders also need handling.
Before publishing
- Use Staging to test control and every variant.
- Check matching and non-matching locations.
- Verify mobile, desktop, accessibility and analytics behaviour.
- Ask someone else to review the setup.