Skip to content
Advertisement

Uncaught SyntaxError: Unexpected token < into DOCTYPE html PUBLIC

I am having a series of JavaScript problems and the only thing I notice in the console.log is:

Uncaught SyntaxError: Unexpected token <

Which leads me to:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

I can not see a syntax error here. Is there any syntax error in this line? How can I fix it?

Advertisement

Answer

The error message indicates a JavaScript syntax error.

The code you quoted is XHTML, which is not JavaScript. Trying to treat it as JavaScript (as you are doing) is doomed to failure.

This is probably caused by entering the wrong URL in a src attribute.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement