Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript/jQuery | Uncaught SyntaxError: Unexpected end of input?

Tags:

jquery

jQuery noob checking in here. What is wrong with my syntax? I get Unexpected End of Input in Chrome console.

 <script>
$('a[href*=#]:not([href=#])').click(function() {
  if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') 
     || location.hostname == this.hostname) {

     var target = $(this.hash);
     target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
        if (target.length) {
          $('html,body').animate({
              scrollTop: target.offset().top
         }, 1000);
         return false;
        }
     }
 });
</script>
like image 598
Necro. Avatar asked Sep 23 '26 15:09

Necro.


1 Answers

It means you've forgotten a closing }, ), >, or whatever is used in its syntax. Check all of your blocks and statements to see if you've left out any closing mark.

if you copy your code into jsbeautifier.org, click on "Beautify" and see if all of the indentations are correct.

like image 131
Techie Avatar answered Sep 25 '26 09:09

Techie



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!