A
A
Arthur Levenson2021-07-07 09:56:13
JavaScript
Arthur Levenson, 2021-07-07 09:56:13

How to reset the color?

Tell me how to make it so that by clicking on .reset the colors are reset. I need to remove the additional class active on clicking reset

code example https://codepen.io/kiskiskit/pen/MWmypaB

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2021-07-07
@kiskiskit

const button = document.querySelector('.reset');
button.addEventListener('click', () => {
    document.querySelectorAll('.active').forEach(element => element.classList.remove('active'));
});

well, replace with<div class="reset">сброс цвета</div>
<button type="button" class="reset">сброс цвета</button>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question