Skip to content
Advertisement

Tag: class

Console.log from a class’ function

I want to test if my function inside my class returns the given sentence. But if I try to test using console.log, it returns ReferenceError: rev is not defined. What am I doing wrong? I’m a fairly new programmer, so bear with me if this is a stupid question. Answer The entire point of a class is to provide a

How do I replace a class for a child element?

I have a piece of code that, while it works perfectly elsewhere, is not working when I try to apply it to a child element. I am trying to simply replace a class in the classList for an i element when the addEventListener(“mouseover” for the parent tag is triggered. Here’s my code: This should be pretty straight forward but, for

Close Dropdown when other Dropdown is toggled active

i am trying to close let´s say Dropdown A automatically, when Dropdown B gets classList.toggle(“active) (in this case i toggle the ClassList with a Click) I can open (classList.toggle(“active)) and close (classList.toggle(“inactive)) it manually, but i want to close it automatically. Right now i got this: The Problem is now: when i click on one of the 4 Modules of

Advertisement