I’m having an issue when trying to remove/add a class and replacing text on the page. Specifically, I’m having a button change from add to remove after being clicked; I can see the text of the button changed, but it quickly reverts back afterwards. Same problem when removing or adding a class. Changes are made, but reverted back in split second. My code is basically
function changeButtonText(id){
const addButton = document.getElementById(id);
addButton.innerText = 'Remove';
}
I can see in the inspector it briefly changes, and then reverted back to add. I have no idea what could be causing this. Any insights?