Skip to content

Instantly share code, notes, and snippets.

@sabrina-zeidan
Created September 18, 2020 08:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sabrina-zeidan/d6fbea725f6933ce92735a44c76aa8cd to your computer and use it in GitHub Desktop.
Save sabrina-zeidan/d6fbea725f6933ce92735a44c76aa8cd to your computer and use it in GitHub Desktop.
Hide child if parent has (not) another child with class [JS]
//<div class="elementor-column"><div class="dce-acf-repater-"><div class="repeater-item"></div></div><div class="elementor-widget-button"></div></div>
(function( $ ){
$(".elementor-column .dce-acf-repater-").each(function() {
if (!$(this).has(".repeater-item").length) {
hide = $(this).closest('.elementor-column').find(".elementor-widget-button").hide();
}
});
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment