Trying To Update Css Variable Using Javascript AddEventListener, But It Is Working Only Once
So, I'm trying to make a switch theme button using filter:invert(var(--variable-name)) and I'm updating the value of the variable using javascript. I have made a button and added a
Solution 1:
I believe you've added a listener in a wrong way. addEventListener accepts a function and You're just invoking myfunc(), instead of passing a reference to it
document.getElementById("btn").addEventListener("click", myfunc);
Post a Comment for "Trying To Update Css Variable Using Javascript AddEventListener, But It Is Working Only Once"