Gill Bates
Gill Bates

Reputation: 15217

jQuery-UI: Uncaught SyntaxError: Unexpected token

Here is what I have in HTML:

<!DOCTYPE html>
<html>
<head>

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

    <title>test</title>
</head>
<body>

</body>
</html>

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?

Upvotes: 2

Views: 16981

Answers (1)

Denys S&#233;guret
Denys S&#233;guret

Reputation: 382464

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>

Upvotes: 35

Related Questions