Uncaught SyntaxError: Unexpected token <

I have two errors on my page,

Uncaught SyntaxError: Unexpected token <

they are the same error, not sure if they are related. Here is my website

Hi There,

Thank you for writing in, there can be a multiple factor that can cause that issue, please do the following.

  • Ensure that you are fully up to date. WordPress, Theme, and Cornerstone (Version Compatibility)

  • Clear all the site caches (plugin, server-side, CDN, and browser’s cache) so that the code from the latest release is always in use. This will help you to avoid any potential errors. While you’re at it, please deactivate this caching feature while we tackle this issue.

  • Test for a plugin conflict. You can do this by deactivating all third party plugins, and seeing if the problem remains. If it’s fixed, you’ll know a plugin caused the problem, and you can narrow down which one by reactivating them one at a time.

  • Remove custom Javascript and custom templates (if any).

Let us know how it goes,
Cheers!

Hi,

I have disabled all custom JS, caching, cdn, and third party plugins. Theme and plugins should be up to date.

The issue seems to be related to this line:

	<script id="x-custom-js"><script>jQuery(document).ready(function() {

Thanks

Hi again,

That’s happening due to the <script> tag you’ve included in your code. Please note that there’s no need to include <script></script> tags in the JS section as they are included by default. Just remove the <script></script> tags from your code to fix the issue.

Let us know how this goes!

Hi Nabeel,

Is there a specific file I should modify to remove this?

Thanks

Hi Allen,

When you’re adding custom JavaScript into your site through Theme Options or Cornerstone’s Custom JS area, you don’t need to add script tags as mentioned by @Nabeel above.

You can see more information from here (https://theme.co/apex/forum/t/customizer-custom-options/142).

Thanks!

Hi again,

You can remove / modify the global JS via Theme Options > JS the above documentation shared by @mldarshana is now outdated. You can checkout https://theme.co/changelog/#theme-x-6-0-0 instead.

Hope this helps!

Ok, that solved the issue. Thanks so much!

You’re most welcome and have a nice weekend!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.