SyntaxError: Unexpected token <

Asked by At

I have a SyntaxError in jquery.validate.min.js File

How I can solve it?

SyntaxError: Unexpected token < /

2 Answers

Community On

Most of the time, the error SyntaxError: Unexpected token < is caused if the src of a script tag refers to file which was not found.

So, I recommend you to check the url of the script's src for validity.

Nino Filiu On

The error is likely to mean that a .js file was fetched but an HTML was returned, probably because of an error 404 or similar. If you'd inspect the file that was fetched in the console (eg: in Chrome or Firefox, F12, then go to the network tab, then click on jquery.validate.min.js), you'll see some HTML content instead of the script for jquery.validate.min.js. Additionally that'd display the HTML of the error message from the server (404 page not found, 403 forbidden, etc).

You should check your connexion, check that your page has the sufficient authorizations to load content from, and use instead of / in your script tag.