Gill Bates Gill Bates - 4 months ago 53
jQuery Question

jQuery-UI: Uncaught SyntaxError: Unexpected token

Here is what I have in HTML:

<!DOCTYPE html>

<script type="text/javascript" src="/static/jslibs/jquery-ui-1.10.2.custom/css/ui-lightness/jquery-ui-1.10.2.custom.css"></script>



And here is what I got with it:

Uncaught SyntaxError: Unexpected token .
...Here code caused exception...
.ui-helper-hidden {
display: none;

Does anybody familiar with it?


You're confusing js files and css files.

You're using a script element to import a css file, hence the error. JQuery UI needs both a CSS file and a JS file, and they must be imported in separate elements. It should look like this :

<link type="text/css" href="lib/jquery/ui-darkness/jquery-ui-1.8.21.custom.css" rel="stylesheet" /> 
<script charset="UTF8" src="jquery.min.js"></script>
<script charset="UTF8" src="lib/jquery/jquery-ui-1.9.0.custom.min.js"></script>