输入意外结束
Unexpected end of input
我在添加到WordPress页脚的JavaScript部分有一些问题。hp:
<script>
jQuery('.showPosts').on('click', function() {
if (jQuery(this).hasClass('hidePosts')) {
jQuery(this).children('div').hide();
jQuery(this).removeClass('hidePosts');
jQuery(this).children('.greekCross').html('✚');
} else {
jQuery(this).children('div').show();
jQuery(this).addClass('hidePosts');
jQuery(this).children('.greekCross').html(' ➡');
}
});
jQuery('.search-field').attr('placeholder','TYPE IN SEARCH TAGS...');
jQuery('.videoText').remove();
jQuery('.ytVideoContainer').addClass('left');
jQuery('.catContainer').addClass('right');
jQuery('.catContainer').addClass('noMarginTop');
var mq = window.matchMedia('(min-width: 767px)');
if (mq.matches) {
// window width is at least 767px
jQuery('.relatedVideoThumb').show();
} else {
jQuery('.postcontentTitle').insertBefore('.catContainer');
jQuery('.postcontent').insertBefore('.catContainer');
jQuery('.relatedVideoThumb').hide();
}
var winWidth = 0;
jQuery(window).resize(function() {
winWidth = jQuery(window).width();
if (winWidth < 768) {
jQuery('.postcontentTitle').insertBefore('.catContainer');
jQuery('.postcontent').insertBefore('.catContainer');
jQuery('.relatedVideoThumb').hide();
} else {
jQuery('.catContainer').insertBefore('.postcontent');
jQuery('.catContainer').insertBefore('.postcontentTitle');
jQuery('.relatedVideoThumb').show();
}
});
jQuery('.site-header .home-link').css('border', '0');
</script>
每次我重新加载页面时,我都会在谷歌Chrome控制台中收到以下内容:
Uncaught SyntaxError: Unexpected end of input
为了优化,我不得不查看Firefox Firebug扩展,看看这个意外的输入端到底在哪里。我收到了以下信息:
SyntaxError: missing } in compound statement
); }});jQuery('.site-header .home-link').css('border', '0');
------------------------------------------------------------
我不知道我在哪里做错了什么,我已经仔细检查了一遍,但我找不到错误,所以任何指导或解决方案都非常受欢迎。
SyntaxError: missing } in compound statement
此错误消息告诉您添加}
此时丢失。
尝试添加。
我想您还必须添加)
来完成您的javascript代码。
相关文章:
- 使用ajax的输入jquery意外结束
- jquery ajax”;SyntaxError:意外的输入结束“;基于有效的JSON
- jQuery Ajax+经典ASP返回错误'意外的输入结束'
- Json响应错误Json.parse:意外的数据结束错误
- json错误json.parse:意外的数据结束错误
- `同构的fetch`response.json()方法总是抛出意外的输入结束错误
- js文件的第1行出现意外的输入结束错误
- 未捕获的语法错误:输入JavaScript意外结束
- 未捕获语法异常:第1行输入意外结束
- 节点.js未定义:1 [语法错误:输入意外结束]
- Ajax 调用返回语法错误:输入意外结束
- $.getJSON:JSON 数据第 1 行第 1 列处数据意外结束
- nodejs + archiver,为什么这个zip存档下载器不起作用(存档意外结束)
- 谷歌浏览器:语法错误:输入意外结束
- 解析意外结束
- 语法错误:JSON.parse:意外的数据结束
- 意外的输入结束 - 快速/节点应用程序上的 curl JSON
- 未捕获的语法错误:输入时刻意外结束.min.js:7
- 带有 JavaScript 异常的 ajax:意外的输入结束
- JSON.parse 意外结束数据火狐狸插件