So, I am working on a 'tab' system. So, whenever I click on the button, a new tab is added.
Each of the tabs should redirect to a new website, tab1 redirects to tab1.html, tab2 redirects to tab2.html and so on.
My issues are:
If there are 3 tabs 'active' they should remain active and they should be displayed even if I switch pages. I should be able to see the same tab-bar in all pages.
Each tab needs to redirect to a new website. I'm not entirely sure how to place a variable in this piece of code so the link dynamically changes.
$("#bar").append("<div id='new_div'><a href='$test'>Redirect</a></div>");
This is my code so far:
index.html
I have researched on my own about this but nothing seems to adapt to my needs. Any help will be highly appreciated.
$(document).ready(function() {
$("#button").click(function() {
$("#bar").append("<div id='new_div'><a href='$test'>Redirect</a></div>");
});
});
#main_container {
width: 100%;
height: 100vh;
}
#bar {
width: 100%;
height: 5%;
background-color: blue;
display: flex;
flex-direction:
}
#new_div {
width: 50%;
height: 100%;
background-color: yellow;
border-right: 1px solid black;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<div id="main_container">
<div id="bar">
</div>
<input type="button" id="button" value="Click me">
</div>