• Resolved johannes999

    (@johannes999)


    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?

    thanks

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • You have a roaming “>” in your first script at the end. I removed it here. I recommend using a code editor to check your code.

    This should help.

    <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>
    
    
    Thread Starter johannes999

    (@johannes999)

    thank you very much ,

    I had removed something in the footer.php it comes from that . I never could think about it .

    thanks again

    johannes

    • This reply was modified 1 year, 2 months ago by johannes999.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘when I open inspect element I see syntaxError under console tab?’ is closed to new replies.