jquery – JavaScript error (Uncaught SyntaxError: Unexpected end of input)

jquery – JavaScript error (Uncaught SyntaxError: Unexpected end of input)

Add a second });.

When properly indented, your code reads

$(function() {
    $(#mewlyDiagnosed).hover(function() {
        $(#mewlyDiagnosed).animate({height: 237px, top: -75px});
    }, function() {
        $(#mewlyDiagnosed).animate({height: 162px, top: 0px});
    });
MISSING!

You never closed the outer $(function() {.

In my case, I was trying to parse an empty JSON:

JSON.parse(stringifiedJSON);

In other words, what happened was the following:

JSON.parse();

jquery – JavaScript error (Uncaught SyntaxError: Unexpected end of input)

http://jsbeautifier.org/ is helpful to indent your minified JS code.

Also, with Google Chrome you can use pretty print. See the example screenshot below showing jquery.min.js from Stack Overflow nicely indented right from my browser 🙂

enter

Leave a Reply

Your email address will not be published.