Skip to content
Advertisement

Tag: toggle

can’t remove class after click again

I tried to color the text I clicked on by gave them a class and besides the text I click on the original color is back again, but when I click on the text twice the class can’t be removed. I use toggle class for this issue but doesn’t work. Answer Cache the main list element, and the list items,

How to handle event element in container?

I want to click btnToggle, Navigation will run but I don’t know why this code sometimes is successful, sometimes is unsuccessful. Help me please, thanks all Answer You’re pretty close. Because you attached the event listener to document, your callback function will actually run if you click anywhere on the page. And because browsers have something called event bubbling, that

Advertisement