Jquery,really makes easy to work with scripts,and the updates in it's api is really impressive,hence this trick is very easy in which you do not have to add any class in the parent element (which contain child elements) in the listing.But it will be added by using Jquery and you can customize accordingly.
Check the pen below to see the effect
The method I've used is
.has()function that decrease the set of matched elements that have
ulas a child element in it.Then,
.addClass()to add a specific
classin the set of matched elements.