I have been trying to build a multi-level vertical tabs with hidden content which gets visible by some jquery. It is working fine but with it has one problem.
Because of this code:
This particular piece is causing all the Parent categories without subcategories to be hidden:
If you remove that, all the Parents without subcategories won't disappear permanently. However, there is still an issue with them temporarily disappearing when opening the subcategory.
You need to have a class that is applied to all your parents that you can use as a selector in this loop:
I'm still not 100% sure this is the exact functionality you want, but here is an updated version:
Whatever the case, you may be better off using nested lists for your subcategories. https://www.w3.org/wiki/HTML_lists