views:

79

answers:

2

OK, well, this has got to be something really dumb.

I've got a little JSP app. I want to add a date picker. I downloaded the jQuery UI bundle. If I point chrome at the index.html that it gives me as a demo, all is well. When I move the pieces into my webapp, not so good.

The chrome console shows two things:

  1. Resource interpreted as script but transferred with MIME type text/html.
  2. Uncaught TypeError: Object # has no method 'datepicker'

Obviously, the second is where the headache arrives. I do have a <div id='calendar'>.

<head>
        <link rel="stylesheet" type="text/css" href="/css/harvest.css" />
        <link type="text/css" href="/css/smoothness/jquery-ui-1.8.2.custom.css" rel="stylesheet" />
        <title>Data Collection</title>
        <script type="text/javascript" src="/js/jquery-1.4.2.min.js"></script>
        <script type="text/javascript" src="/js/jquery-ui-1.8.custom.min.js"></script>
        <script type="text/javascript"> 
            $(function(){
                // Datepicker
                $('#calendar').datepicker({
                    inline: true, altField: 'input#date', altFormat: 'yy-mm-dd'
                });
            });
        </script>
    </head>
+1  A: 

EDIT: I figured it out. (I'm pretty certain)

you have a script loading from /js/jquery-ui-1.8.custom.min.js, but when I dl a ui bundle, it downloads a file js/jquery-ui-1.8.2.custom.min.js. Notice that the second one has a 2 in it. When I did that, everything worked again for me.

Here are the following basics that I can think of:

  • what happens when you directly go to /js/jquery-1.4.2.min.js and /js/jquery-ui-1.8.custum.min.js ? If those don't work then obviously you have a wrong pathname.
  • have you downloaded a jquery ui package before? perhaps the index.html page you are viewing is not associated with the ui package you dl'ed but with a differently downloaded ui package (which may indicate that you simply forgot to check the datepicker box when dl'ing it this latest time)
  • is there some page that's cached in Chrome? does deleteing all cache help?
  • what happens when you try it in FF, IE, or Safari?
Thr4wn
Sure enough. Dislexics of the world untie. Now all I have to do is shrink it from size 12 to some reasonable size.
bmargulies