Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
48
rated 0 times [  53] [ 5]  / answers: 1 / hits: 31763  / 10 Years ago, mon, october 6, 2014, 12:00:00

I have some issues with a JavaScript portion that I have added to my WordPress footer.php:



<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>


Every time I reload the page I receive in the Google Chrome Console the following:



Uncaught SyntaxError: Unexpected end of input



Being minified for optimization purposes I had to look into Firefox Firebug extension to see where exactly is this unexpected end of input. I received the following:



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


I don't see where I could had done something wrong, I've more than double check it but I am unable to find the mistake so any guidance or solution is more than welcomed.


More From » jquery

 Answers
2

SyntaxError: missing } in compound statement



This error message tells you to add a } is missing at this point.



Try to add it.



I suppose you will also have to add ) to complete your javascript code.


[#69223] Friday, October 3, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
bethv

Total Points: 215
Total Questions: 101
Total Answers: 89

Location: Angola
Member since Wed, Jun 2, 2021
3 Years ago
;