by using my this code i can add a single class and and for only on click event once the events occurs it doesn't
stay for the long period of the style.... some soultions
@shivamyadav
can you write briefly about this i'm not able to understand it
do you need a link active in red colour or what ? while clicking on the link if you want active that link then you can follow below code
// Select all navigation links
const links = document.querySelectorAll('.home');
// Loop through each link
links.forEach(link => {
link.addEventListener('click', function() {
// Remove the active class from all links
links.forEach(link => link.classList.remove('bg-red-400'));
// Add the active class to the clicked link
this.classList.add('bg-red-400');
});
});