Hey there -
I have two separate collection lists parent dovs I’m trying to apply the following code to:
<script>
$('.w-dyn-empty').parents('.section').each(function(){ $(this).hide()})
</script>
I’ve applied classes to ‘.w-dyn-empty’ to try to target. Having no luck. Is there a way to change the default class name for empty list items?
Thanks
Here is my public share link: LINK
(how to access public share link )
vincent
(Vincent Bidaux)
August 9, 2019, 2:09pm
2
I can’t help you with the code, but can you tell more about what you’re trying to achieve with JS that you can’t do inside of Webflow?
sam-g
(Sam G.)
August 9, 2019, 2:38pm
3
Is this inside of a document ready function?
Guessing you are trying to hide the parent section of an emtpy CMS element?
Correct. I have two different CMS collections on a page. Want to hide the parent of one of them when the CMS element is empty. (The other is empty as well, but I’m displaying a custom message there)
sam-g
(Sam G.)
August 9, 2019, 2:54pm
5
@Kyle_Winton is it in a document ready function?
Below is some sample code I’ve used for this in the past:
$(function() {
var dividers = $('.service-divider');
$('.case-services.w-dyn-bind-empty').each(function() {
$(this).prev(dividers).remove();
});
});