jQuery-UI: Uncaught SyntaxError: Unexpected token

15,567

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>
Share:
15,567
Gill Bates
Author by

Gill Bates

Updated on June 13, 2022

Comments

  • Gill Bates
    Gill Bates almost 2 years

    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?