Home › Forums › Pro Support › Hide container when post list is empty › Reply To: Hide container when post list is empty
July 12, 2018 at 2:30 am
#5223
Participant
Still wasn’t working so I had a blind man’s tinker and somehow managed to find the problem.
In the end the only remaining problem was you had an ID instead of a class designated for the container. What I ended up using was:
jQuery( document ).ready( function( $ ) {
if ( $( '.wpsp-no-results' ).length ) {
$( '.wpsp-no-results' ).closest( '.generate-sections-container' ).hide();
}
} );
And it works perfectly! Such a good result for such a small amount of code.
Thanks so much for helping with this. Now I also know how to use the .closest tag. 🙂