I have a regular bootstrap tab panel that allows me to switch between blocks
In List 1's content, I included a button called Go to List 2
However, I am struggling to figure out how to make it so that clicking on this button will switch to the List 2 tab
I've tried adding various attributes to the a
tag like id and others, but it hasn't been successful
li {
margin: 0;
display: block;
}
li:before {
display:none;
}
.nav {
border-radius: 10px 10px 0 0;
justify-content: center;
}
.nav > li > a {
margin-top: 10px;
padding: 10px 40px;
display: block;
}
.nav-tabs > li > a {
font-size: 18px;
color: black;
border: none;
text-decoration: none;
}
.nav-tabs > li > a.active {
margin: 10px 0;
color: white;
background: #A700FF;
border-radius: 10px;
}
.info {
padding: 30px;
text-align: center;
}
.go-to {
margin: 0 100px;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="fd9f9292898e898f9c8dbdc8d3cdd3cc">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="13717c7c67606761726353263d233d22">[email protected]</a>/dist/js/bootstrap.min.js" integrity="sha384-Atwg2Pkwv9vp0ygtn1JAojH0nYbwNJLPhwyoVbhoPwBhjQPR5VtM2+xf0Uwh9KtT" crossorigin="anonymous"></script>
<ul class="nav nav-tabs" role="tablist">
<li role="presentation"> <a href="#list1" id="list1-tab" data-bs-toggle="tab" data-bs-target="#list1" role="tab" aria-controls="list1" aria-selected="true" class="active">List 1</a> </li>
<li role="presentation"> <a href="#list2" id="list2-tab" data-bs-toggle="tab" data-bs-target="#list2" role="tab" aria-controls="list2" aria-selected="false" class="">List 2</a> </li>
<li role="presentation"> <a href="#list3" id="list3-tab" data-bs-toggle="tab" data-bs-target="#list3" role="tab" aria-controls="list3" aria-selected="false" class="">List 3</a> </li>
<li role="presentation"> <a href="#list4" id="list4-tab" data-bs-toggle="tab" data-bs-target="#list4" role="tab" aria-controls="list4" aria-selected="false" class="">List 4</a> </li>
</ul>
<div class="tab-content">
<div id="list1" role="tabpanel" aria-labelledby="list1-tab" class="tab-pane active">
<div class="info">List 1 info</div>
<a href="#list2" class="go-to">Go to List 2</a>
</div>
<div id="list2" role="tabpanel" aria-labelledby="list2-tab" class="tab-pane">
<div class="info">List 2 info</div>
</div>
<div id="list3" role="tabpanel" aria-labelledby="list3-tab" class="tab-pane">
<div class="info">List 3 info</div>
</div>
<div id="list4" role="tabpanel" aria-labelledby="list4-tab" class="tab-pane">
<div class="info">List 4 info</div>
</div>
</div>