JavaScript - Uncaught SyntaxError: Unexpected token ?

html, javascript, jquery

Solution

You have an illegal invisible character at the end of this line...

$('#test').append("Test");​// <-- right before this comment

Delete the line entirely, and retype it, or make sure the cursor is after all characters on the line, and hit backspace until you see characters actually being removed.

This happens sometimes if you copy & paste code from jsFiddle.

The charCode of the offending character is 8203.

Problem

What is wrong with this sample code? o_O ``` <html> <head> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ console.log("Testing"); $('#test').append("Test");​ }); </script> <title>Sin título 4</title> </head> <body> <div id="test">Hello world.</div> </body> </html> ```

Original source

Related problems