I'm currently working on creating a unique feature that is reminiscent of a jQuery tree. Instead of allowing nodes to expand and collapse under their parent, I want the div to only display the children without showing the parent at the same time. The idea is to have a button that allows users to navigate back to displaying the parent node only.
For example:
Imagine there's a parent node in a div,
when you click on the "parent" node, the div will refresh to display only its child nodes (hiding or removing the parent node) with a button to return to the previous parent node display.
I've already serialized the hierarchy from a JSON file and cached it at the front end. I tried using the following code snippets:
document.getElementById('parent').parentNode.style.display='none';
or
.parent {
visibility: hidden;
}
But so far, I haven't been able to achieve the desired result.
Does anyone have any hints? I'm particularly unsure if there's an open-source library out there that can help with this specific functionality (as it differs from a standard jQuery tree). I'm not even sure what keywords to search for in relation to this type of structure.
Any hints or keywords would be greatly appreciated!