Why is class list and add not working?? | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
0

Why is class list and add not working??

Line 12 gives me and error yet that's how I wrote it in Vscode and it's working https://sololearn.com/compiler-playground/W0SuAw97u718/?ref=app

21st Feb 2024, 2:42 PM
Indiphile Menziwa
Indiphile Menziwa - avatar
2 Respuestas
+ 1
there is only one ".nav-dots", hence slidesIcon has the length 1. and what should happen for slideIndex > 2?
21st Feb 2024, 4:27 PM
Lisa
Lisa - avatar
0
document.querySelectorAll(".nav-dots"); should be changed to document.querySelectorAll(".slide-icon"); And also the Event handler is wrong in so many ways slideIndex needs to be limited as << slides[slideIndex] >> is bound to be undefined if slideIndex=>3 Take a look https://sololearn.com/compiler-playground/W7MA69v8x1Sw/?ref=app
29th Feb 2024, 11:05 PM
IAmSupreme
IAmSupreme - avatar