Uncaught TypeError: Cannot read property 'classList' of undefined
Each element has a child element collection you can access called children, so you can modify them by parent.children[position].classList.add('new-class');
Things you can improve here: - consider assign a function to the event handler to avoid multiple listeners working at the same time - changing currentTarget to target ensure your code will take the right element - if the parent will be the same, attach it to a global instead of creating multiple scoped versions of the same thing
Обсуждают сегодня