Skip to content

Instantly share code, notes, and snippets.

@wdfx100
Created March 24, 2013 08:34
Show Gist options
  • Save wdfx100/5231091 to your computer and use it in GitHub Desktop.
Save wdfx100/5231091 to your computer and use it in GitHub Desktop.
Chrome调试js出现Uncaught SyntaxError: Unexpected identifier
chrome下运行编写的javascript代码时,在工具javascript控制台下有时会出现“Uncaught SyntaxError: Unexpected identifier ”的报错,经过我反复查看代码最后得出,原来是代码中缺少一个“,”(英文逗号)。
后经在网上查阅,也有文章指出,如果该异常出现在define里多半是因为你在该行的上一行缺少了逗号。
原来如此简单!
在js中出现下面的错误:
Uncaught SyntaxError: Unexpected identifier可能的原因是:
有可能是字符串类型的,但是并没有加双引号。
如:
document.getElementById('s3_selectCustomName').value=customName;
可能会出现上述错误。改正方法:
document.getElementById('s3_selectCustomName').value="customName";
这样即可!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment