This snippet is a helpful jQuery script, especially for conditional visibility, where you want to remove a parent if a child has a particular class: -
Example Usage: Hiding a Collection Item parent Div in Webflow with an additional Condition on Child Div with jQuery. Solve Webflow insufficient Filter Conditions.
Webflow Filters and Conditional Visibility are vital features but don't give mixed And/Or conditional visibility combinations. We can use this jQuery snippet where we need further And/Or Conditional Visibility in Webflow to hide an element.
For instance, in a Collection Wrapper, if you have your maximum Filter combinations running on your 'Collection Item', you can target the first child div below with an additional Webflow Condition. We can then hide the Collection Item (the parent div) by using the class on the first child 'child-main-class with 'w-condition-invisible' set by the new Webflow Condition.
This jQuery script removes the parent of the new conditionally hidden Div, which is the Collection Item
Join in the Discussion