Toggle Implementation Question

Asked 2 years ago, Updated 2 years ago, 92 views

const handleClick = e => {
  let isOn = e.currentTaget.classList.contains('on');
  if (isOn) {
    e.currentTaget.classList.remove('on');
  } } else {
    e.currentTaget.classList.add('on');
  }
}

Hello!

I want to turn on the other elements when the on button turns off How do I insert the code?

I'd really appreciate your help!

javascript react

2022-09-20 11:17

1 Answers

This is what we usually do:

event target = clicked yosok


2022-09-20 11:17

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.