Is there a way to apply a border-bottom to btn_articles and btn_posts when one of them is clicked? I attempted to use the active class but it did not have the desired effect. Any suggestions or solutions would be greatly appreciated.
let btn_articles = document.getElementById('btn_articles');
btn_articles.addEventListener('click', function(){
let articles = document.getElementById('container_articles');
let container_posts = document.getElementById('container_posts');
articles.style.display = "flex";
container_posts.style.display = "none";
})
let btn_posts = document.getElementById('btn_posts');
btn_posts.addEventListener('click',function(){
let container_posts = document.getElementById('container_posts');
let articles = document.getElementById('container_articles');
container_posts.style.display = "flex";
articles.style.display = "none";
})
.btn-profile-buttons:hover{
color:#4dcadd;
border-bottom:3px solid #4dzadd;
}
.btn-profile-buttons{
border-bottom:3px solid #4dzadd;
}
.profile-buttons a{
margin:0rem 2rem;
padding:0.5rem 1rem;
text-decoration: none;
color:#000;
transition: 0.3s ease-in-out;
}
.active{
color:#4dzadd;
border-bottom:3px solid #4dzadd;
}
<div class="profile-buttons" id = "profile-buttons">
<a id = "btn_articles" href = "#" class = "btn-profile-buttons active">Articles </a>
<a id = "btn_posts" href = "#" class = "btn-profile-buttons ">Posts </a>
</div>