Foundation 5: Unexpected end of script

While I was creating a theme for WordPress and reached the menu editing I see the menu doesn’t work, so after checking the console log, I notice that foundation.min.js have an issue with Unexpected end of script

What can cause this type of error:

Read More

Unexpected end of script

I read where it say because your missing a }); ending, but that is not my case, since i re-upload the foundation.min.js

This problem is interfering with another aspect of foundation as well, here are the other error also come up in the console log.

ReferenceError: Can’t find variable: Foundation

TypeError: undefined is not a function (evaluating
‘jQuery(document).foundation()’)

This problem also started when I start using Cloudfront by AWS (but I doubt this can be the problem)

Image of the errors:

enter image description here

Foundation 5 Line of Error Image:

enter image description here

Related posts

Leave a Reply

2 comments

  1. There is a good chance the errors you are seeing are caused by the way you’re including the Foundation javascript file into your html file, and the place where you’re then calling .foundation() to make use of it.

    Ensure you include the js before any script which makes use of it.
    Ensure the version of jQuery you’re using works with the version of Foundation js you’re using.

    Check other javascript which may have additional or missing brackets which are then messing with the parsing of the foundation script.

  2. Since you are using Cloudfront, I assume you are using W3 Total Cache as well. Is that correct? I’ve seen issues like this when W3 Total Cache minifies your Javascript.

    Before you rip your hair out digging through foundation.min.js, I recommend ruling out a few things. I would first recommend disabling Cloudfront in W3 Total Cache. This will rule out the possibility of Cloudfront not storing the latest js.

    Second, I would recommend checking your js minify options in W3 Total Cache. Try disabling this as well, or adjusting the minify algorithm.