输入意外结束

Unexpected end of input

本文关键字:结束 意外 输入      更新时间:2023-09-26

我在添加到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('&#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>

每次我重新加载页面时,我都会在谷歌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代码。