0

why this erorr Uncaught TypeError: Cannot set property 'className' of undifined Line 6

why this error can happen when this is exactly the same as in the example https://code.sololearn.com/W05OhQU2k4Kb/?ref=app and this is an example : https://codepen.io/SitePoint/pen/KzjpGj

4th May 2018, 3:32 PM
Hafizd Jubaidir
Hafizd Jubaidir - avatar
2 Antworten
+ 4
Because your code runs prior to the webpage being loaded, slides is null. This adding onload function fixes it. https://code.sololearn.com/Wdz7LE4T129V
4th May 2018, 4:23 PM
John Wells
John Wells - avatar
+ 1
John Wells ok the code is working as I want thanks for helping me overcome this erorr
4th May 2018, 4:53 PM
Hafizd Jubaidir
Hafizd Jubaidir - avatar