Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/73.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 输入意外结束_Javascript_Jquery_Wordpress - Fatal编程技术网

Javascript 输入意外结束

Javascript 输入意外结束,javascript,jquery,wordpress,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');

我对添加到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>

我不知道我哪里做错了什么,我已经仔细检查了一遍,但是我找不到错误,所以任何指导或解决方案都是非常受欢迎的

复合语句中的语法错误:缺少}

此错误消息告诉您添加一个此时缺少的
}

尝试添加它


我想您还必须添加
来完成javascript代码。

您的脚本块是正确的,错误在其他地方。尝试删除这个
块并再次签入google chrome…这就是全部javascript代码吗?也许您的代码以
$(document).ready(function(){
)开头,所以
}
丢失了。我最终找到了答案。这是因为我使用的minify插件(WP Super minify)以某种方式造成了这个问题。我已经尝试过了,但没有解决。正如我上面提到的,我用来缩小js文件的wordpress插件会产生问题。因此,如果错误与缩小器有关,则应该对其进行更改。可能是wordpress或使用的库中存在更新。我实际上已重新激活并删除了
mq.matches
的if语句,出于某种奇怪的原因,错误消失了,但功能正常工作。
SyntaxError: missing } in compound statement
); }});jQuery('.site-header .home-link').css('border', '0');
------------------------------------------------------------