Hiding empty CMS field label

Hello everyone,

I’m creating a website which includes a list of upcoming events. These events typically have the same type of information but occasionally we need to include the organisers contact details. So I’ve created a CMS collection which has an optional section for a phone number, email address, name etc. My question, is there a way for static page text which labels dynamic content to disappear if that specific CMS field is left empty?

Example with contact information:

Event name
Description: Fun event description.
Organiser: William Tingle
Phone number: 00000 000000

Example without contact information:

Event name
Description: Fun event description.

I hope that makes sense. Cheers, Matt

@Matthew_Bowker_96 I have solved this with JavaScript in the past. Here is a sample script, but this would need to be adapted for your specific scenario:

var dividers = $('.service-divider');
$('.case-services.w-dyn-bind-empty').each(function() {

In this scenario I had little dividers (the pipe character “|”) between a list of dynamic elements. Essentially this searches each dynamic element and if it has the class of .w-dyn-empty it finds the previous divider and removes it.

As I said this would need to be customized for your specific use case, but that should get you on the right path.

Thinking about this you may be able to hide the static elements using the CMS in a more clever way, but I’d have to tinker with it to see if it’s possible.