Guides › HTML / PHP sites › Forms, plugins & updates

JavaScript Error: Unexpected Token or Syntax Error After Editing

A missing bracket, quote or comma breaks the whole script file.

Reference guide. This guide is written from established practice and the official documentation of the tools involved. We have not yet tested every step on a live demo site. Back up your site before you change anything.

Fix

  1. The console shows the file and line. See reading the browser console.
  2. Look just before that line for a missing ), }, quote or comma.
  3. Use an editor with syntax highlighting and bracket matching.
  4. If the file was minified or combined by a plugin, disable that setting to see the original error.
  5. Unexpected token < usually means the script URL returned an HTML page (a 404 or error) instead of JavaScript.
  6. For JSON problems, validate the text in a JSON checker.

Restore the previous version from backup if you cannot find the cause quickly.

Related guides

Did this solve it? If not, email hello@sitefixlab.org with the exact error text and we will look into it. Try the problem finder.

Last updated 2026-11-21.