无法通过jQuery datepicker越过pons asinorum [英] failing to cross the pons asinorum with jquery datepicker

查看:70
本文介绍了无法通过jQuery datepicker越过pons asinorum的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,这一定有点愚蠢.

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

我有一个小的JSP应用程序.我想添加一个日期选择器.我下载了jQuery UI捆绑包.如果我将chrome指向它作为演示提供给我的index.html,一切都很好.当我将片段移动到我的Web应用程序中时,效果不是很好.

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.

Chrome控制台显示两件事:

The chrome console shows two things:

  1. 资源被解释为脚本,但以MIME类型text/html传输.
  2. 未捕获的TypeError:对象#没有方法'datepicker'

显然,第二个是头痛到来的地方.我确实有一个< div id ='calendar'>.

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>

推荐答案

我发现了. (我很确定)

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

您有一个从/js/jquery-ui-1.8.custom.min.js加载的脚本,但是当我dl ui捆绑包时,它会下载文件js/jquery-ui-1.8.2.custom.min.js.注意第二个里面有一个 2 .当我这样做的时候,一切对我又恢复正常了.

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:

  • 直接进入/js/jquery-1.4.2.min.js/js/jquery-ui-1.8.custum.min.js会发生什么?如果这些都不起作用,那么显然您的路径名错误.
  • 您之前是否下载过jQuery用户界面包?也许您正在查看的index.html页面与您租用的ui软件包不相关,但是与下载的ui软件包相关联(这可能表明您在最近一次dl时忘记了日期选择器框)
  • Chrome浏览器中是否缓存了某些页面?删除所有缓存有帮助吗?
  • 在FF,IE或Safari中尝试时会发生什么?
  • 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?

这篇关于无法通过jQuery datepicker越过pons asinorum的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆