Javascript in wordpress causes SyntaxError

0👍

According to the error screen shot, you have a line feed between .text(' and <ul>');

This will indeed be a syntax error.

The line feed does not appear to be present in the code you’ve quoted in the question, but it is clearly there in your screenshot.

If you are sure that there isn’t a line feed there, it is possible that it may be a stray invisible character that isn’t showing up in your editor but is affecting the code when it runs. This kind of thing can crop up if you copy and paste code, eg from a website, where some of the hidden markup may inadvertently get copied as well.

Try deleting the characters around the error and re-typing them.

Leave a comment