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:
- Resource interpreted as script but transferred with MIME type text/html.
- 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>
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 filejs/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:
/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.Another reason for getting this error is when you make the call with the wrong case like this: $("#calendar").date*P*icker() instead of $("#calendar").datepicker()
I have struggled to find this error for a few hours.