JavaScript错误(未捕获的SyntaxError:意外的输入结束) [英] JavaScript error (Uncaught SyntaxError: Unexpected end of input)
本文介绍了JavaScript错误(未捕获的SyntaxError:意外的输入结束)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一些可以在FireFox中运行的JavaScript代码,但在Chrome或IE中却没有。
I have some JavaScript code that works in FireFox but not in Chrome or IE.
在Chrome JS控制台中,我收到以下错误:
In the Chrome JS Console I get the follow error:
Uncaught SyntaxError:意外的输入结束。
"Uncaught SyntaxError: Unexpected end of input".
我使用的JavaScript代码是:
The JavaScript code I am using is:
<script>
$(function() {
$("#mewlyDiagnosed").hover(function() {
$("#mewlyDiagnosed").animate({'height': '237px', 'top': "-75px"});
}, function() {
$("#mewlyDiagnosed").animate({'height': '162px', 'top': "0px"});
});
</script>
它说错误是在最后一行});
It says the error is on the last line which is });
推荐答案
添加第二个});
。
正确缩进后,代码读取
$(function() {
$("#mewlyDiagnosed").hover(function() {
$("#mewlyDiagnosed").animate({'height': '237px', 'top': "-75px"});
}, function() {
$("#mewlyDiagnosed").animate({'height': '162px', 'top': "0px"});
});
MISSING!
您从未关闭外部 $(function(){
。
这篇关于JavaScript错误(未捕获的SyntaxError:意外的输入结束)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文