Attention: This page contains partner and advertising links. Therefore this page is to be understood entirety as an advertisement!
For a working solution the :empty selector has to be combined with the :has and :not selector. Actually the :not selector has to be chained and used twice. All not-empty elements can be found using the
*:not(:empty) selector. Since this selector also finds elements that contain or also contain child DOM elements, we have to use the selector
:not(:has(*)) to remove those elements. The complete jQuery code looks like this: