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('✚');
} 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>
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 pound 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 weled.
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('✚');
} 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>
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 pound 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 weled.
<script>
block and check in google chrome again...
– dashtinejad
Commented
Oct 6, 2014 at 13:18
$(document).ready(function(){
.. so the })
is missing.
– Asenar
Commented
Oct 6, 2014 at 13:18
SyntaxError: missing } in pound 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 plete your javascript code.