I get this JS error below when I open my onderhoud page in inspect element?
-
hello,
this is my slideshow code in JS:
<script> let slideIndex = 0; showSlides(); function showSlides() { let i; let slides = document.getElementsByClassName("mySlides"); let dots = document.getElementsByClassName("dot"); for (i = 0; i < slides.length; i++) { slides[i].style.display = "none"; } slideIndex++; if (slideIndex > slides.length) { slideIndex = 1; } for (i = 0; i < dots.length; i++) { dots[i].className = dots[i].className.replace(" active", ""); } slides[slideIndex -1].style.display = "block"; dots[slideIndex -1].className += " active"; setTimeout(showSlides, 4000); // 4000 = Change image every 4 seconds } </script>
when I open home page there is no error but when I open onderhoud page I see this error in inspect element in chrome.
Uncaught TypeError: Cannot read properties of undefined (reading ‘style’)
at showSlides ((index):1363:31)at (index):1346:7
showSlides @ (index):1363
(anonymous) @ (index):1346.index 1363 is showing the line :
slides[slideIndex -1].style.display = “block”;
and the index 1346 is showing the line :
showSlides();how I can solve this problem?
where is the fault? can you correct it?
thanks
The page I need help with: [log in to see the link]
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘I get this JS error below when I open my onderhoud page in inspect element?’ is closed to new replies.