意外的输入结束

时间:2014-10-06 13:09:52

标签: javascript jquery wordpress

我在我的WordPress footer.php中添加了JavaScript部分的一些问题:

<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('&#10010;');
    } else {
        jQuery(this).children('div').show();
        jQuery(this).addClass('hidePosts');
        jQuery(this).children('.greekCross').html('&#160;&#10145;');
    }
});
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>

每次我重新加载我在Google Chrome控制台中收到的页面时都会显示以下内容:

Uncaught SyntaxError: Unexpected end of input

为了优化目的而缩小我必须查看Firefox Firebug扩展,以查看这个意外结束输入的确切位置。我收到了以下内容:

SyntaxError: missing } in compound statement
); }});jQuery('.site-header .home-link').css('border', '0');
------------------------------------------------------------

我不知道我在哪里做错了什么,我不仅要检查它,而且我无法找到错误,所以任何指导或解决方案都不过是受欢迎的。

1 个答案:

答案 0 :(得分:1)

SyntaxError: missing } in compound statement

此错误消息告诉您此时缺少}

尝试添加它。

我想你还必须添加)来完成你的javascript代码。