johannes999 Posted February 3, 2023 Share Posted February 3, 2023 hello. I get this syntaxError under console tab when I open inspect element on my homepage . Uncaught SyntaxError: Unexpected token I have deleted every unneccesary scripts but the problem exists. I have only this 2 scripts. the first is for FAQ . I don’t know if something wil be wrong here! <script> var acc = document.getElementsByClassName('accordion'); var len = acc.length; for (var i = 0; i < len; i++) { acc[i].addEventListener('click', event => { const accordion = event.currentTarget; const currentlyActiveAccordion = document.querySelector('.accordion.active'); if (currentlyActiveAccordion && currentlyActiveAccordion !== accordion) { currentlyActiveAccordion.classList.toggle('active'); currentlyActiveAccordion.nextElementSibling.style.maxHeight = 0; } accordion.classList.toggle('active'); var panel = accordion.nextElementSibling; if (panel.style.maxHeight) { panel.style.maxHeight = null; } else { panel.style.maxHeight = panel.scrollHeight + 'px' } });> } </script> and second is for slider show : <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> may be it can be in this slidershow script something wrong! but I don’t see myself anything. can some one tell me what it can be this syntaxError? thankshttps://webdesignleren.com/ Link to comment Share on other sites More sharing options...
dsonesuk Posted February 5, 2023 Share Posted February 5, 2023 else { panel.style.maxHeight = panel.scrollHeight + 'px' } });> } </script> BOLD angled closing bracket. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now