In the process of developing a tool to streamline work tasks, I want to ensure that I am following best practices. My goal is for the website to initially display only column A, with subsequent columns generated upon clicking links in the previous ones. Additionally, when a different link in column A is clicked, the corresponding column B should replace the existing one, and column C should be removed if visible.
My current approach involves utilizing a well-structured div layout combined with jQuery to add or remove a "hidden" class from child elements. Each column consists of a floated div containing styled links. One idea is to assign a parent container to each possible section and label them accordingly with classes for easy selection. This way, using jQuery's children().addClass("Hidden") on the parent container can hide sections defined to come after the one linked.
Considering the constraints of not having access to a MySQL database at work and unable to use company information on personal projects, Javascript seems to be the primary option. Can someone provide guidance on implementing this concept effectively?
Note: The code snippet below is incomplete but serves as an example of my current train of thought.
//Snippet of function modemBrands for handling Arris options
$('.ModemMods').children().addClass("Hidden");
$(".Arris").removeClass("Hidden");
~
<div class="NavCon">
<nav>
<!-- Brand options -->
<div class="LinkCon">
<a href="#" onclick="modemBrands('Arris')">Arris</a>
<a href="#" onclick="modemBrands('Motorola')">Motorola</a>
<a href="#" onclick="modemBrands('SMC')">SMC</a>
<a href="#" onclick="modemBrands('Ubee')">Ubee</a>
</div>
<div class="ModemMods">
<div class="LinkCon Arris">
<a href="#" onclick="modemMods('DG860A')">DG860A</a>
<a href="#" onclick="modemMods('DG1670')">DG1670</a>
<a href="#" onclick="modemMods('DG860A')">DG860A</a>
<a href="#" onclick="modemMods('DG1670')">DG1670</a>
</div>
<div class="LinkCon Motorola Hidden">
<a href="#" onclick="modemMods('DG860A')">DG860A</a>
<a href="#" onclick="modemMods('DG1670')">DG1670</a>
<a href="#" onclick="modemMods('DG860A')">DG860A</a>
<a href="#" onclick="modemMods('DG1670')">DG1670</a>
</div>
<div class="LinkCon SMC Hidden">
<a href="#" onclick="modemMods('DG860A')">DG860A</a>
<a href="#" onclick="modemMods('DG1670')">DG1670</a>
</div>
<div class="LinkCon Ubee Hidden">
<a href="#" onclick="modemMods('DG860A')">DG860A</a>
<a href="#" onclick="modemMods('DG1670')">DG1670</a>
</div>
</div>
<div class="ModemRegion">
</div>
</nav>
</div>
Is my course of action correct? Should I consider modifying the function associated with column A links to apply the Hidden class to all parent containers of columns B or C every time it is clicked? Or is there a more efficient method to achieve this functionality?