I dont think you need display function at all, but since you do, you need to execute it, so evrything inside (including attaching event listeners) occur.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Oh sorry about the presentation. This is actually my first post.
let buttons = document.querySelectorAll('button');
function display() {
buttons.forEach(buttons => {
buttons.addEventListener('click', () => {
buttons.classList.add('active')
});
})
}
Sure thing, here you have working minimal example :)
codepen.io/pavelloz/pen/YzZXzXR?ed...
I dont think you need
display
function at all, but since you do, you need to execute it, so evrything inside (including attaching event listeners) occur.