Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modifier initializeClickEvents() pour ne pas associer l'événement à tout le document #17

Open
tfrancart opened this issue Jul 3, 2024 · 0 comments
Assignees

Comments

@tfrancart
Copy link
Contributor

Dans initializeClickEvents() on fait document.addEventListener("click", function (event) {, puis on teste pour savoir si l'élément a la classe "show-more". Ce n'est pas bon car l'événement de clic est capté n'importe où sur le document.

Il faut associer cet événement seulement aux éléments dont la classe est "show-more":

document.getElementsByClassName("show-more").addEventListener("click", function (event) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants