I m building a menu bar which has current class which is highlighted when user clicks.
how do i make it so when someone clicks on li it removes from previous li and put it on new li which is clicked on ??
here is my code
li.forEach(li => {
li.addEventListener('click', () => {
li.classList.add("selected");
li.style.background = '';
li.style.paddingTop = '';
});
});