Dynamically Suppress Box Display Based on Presence of Page Elements

Digioh App Marketplace

Digioh Box Conditions evaluate at the time of page load (DOM Ready). You can use the HTML Exists Condition to target (or anti-target) Boxes based on whether the page contains an HTML Element, using a jQuery Selector. However, this only works if the HTML in question is present at the time of DOM Ready. If you have a single page app (SPA), or JavaScript on your page that dynamically renders HTML, then you may encounter a race condition between your code and Digioh Conditions.

If you need to suppress a Digioh Box based on the presence of dynamic HTML, you can do this with the Digioh App Dynamic Suppression with Selectors. From the profile menu top right, click “Custom JS (Apps)”, then find and install the app.

Use the metadata command dyn_suppress with a value that is the relevant jQuery selector:

Be sure to test in devtools console that your selector finds the HTML, before configuring on your box.

Also, when viewed in boxqamode, the app will notify you when it takes action to suppress.

Questions? Comments? Let us know at contact@digioh.com