简体   繁体   English

JavaScript-未捕获的SyntaxError:意外的令牌?

[英]JavaScript - Uncaught SyntaxError: Unexpected token ?

What is wrong with this sample code? 此示例代码有什么问题? o_O 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>

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. 如果您从jsFiddle复制并粘贴代码,有时会发生这种情况。

The charCode of the offending character is 8203. 令人反感的字符的charCode为8203。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM