Uncaught SyntaxError: Unexpected token CSS Error

I am back after a long time. I have been quite busy with some things in my life and some projects too and today I wanted to get back writing with this mini post. Yesterday I was working on this project of mine and wanted to utilize a third-party drop-down control in a page. It included several js and css files in the library that made it work of course.

I included all the js and css files, referenced jquery and bootstrap libraries as required (either through a CDN or by referencing a local copy, not related to the post anyway) and when I ran the page I saw this weird error message on the console of my browser. It said:

“Uncaught SyntaxError: Unexpected token .”

I was quite surprised cause the tool was downloaded thousands of times before and there were no reported errors on this message. I opened up the css file to check if there was really an error in it. No, no errors…

It was quite late and I was quite tired so I decided to sleep on it and try again this morning. And that was the right decision, sometimes you just can’t see what the problem is even if it is right in front of your nose.

The problem was a simple copy-paste mistake. I was trying to include a css file like it was a js file using “script” tags 😛

If you are seeing the same message, check how you include your css file in your page.

Hope this helps.
Reduce your Carbon Footprint,
Serdar

Leave a Reply

Your email address will not be published. Required fields are marked *