I have a side-navigation bar with content on the right side. How can I display specific content on the right side when clicking on a navigation link? For example, only show the name when clicking on the name link and only show the password field when clicking on the password link.
I am using Bootstrap 5 and simple JavaScript to achieve this functionality for multiple links and contents. Thank you :)
.settings {
display: flex;
}
.tab-details {
margin-left: 30px;
margin-top: 20px;
}
<div class="settings">
<div class="side-nav">
<ul class="sidebar-nav">
<li>
<a class="nav-link" href="#">Name</a>
</li>
<li>
<a class="nav-link" href="#">Password</a>
</li>
<li>
<a class="nav-link" href="#">Security</a>
</li>
</ul>
</div>
<div class="tab-details">
<div id="name-tab">
<form>
<label class="form-label" for="first-name">Name</label>
<input type="text" id="" class="form-control" />
<button type="submit" class="btn btn-primary btn-block mb-4">Save</button>
</form>
</div>
<div id="password-tab">
<form>
<label class="form-label" for="first-name">Password</label>
<input type="text" id="" class="form-control" />
</form>
</div>
</div>
</div>