【问题标题】:Object [object Object] has no method 'calendricalDate'对象 [对象对象] 没有方法 'calendricalDate'
【发布时间】:2012-01-10 08:12:59
【问题描述】:

我收到此错误:

Uncaught TypeError: Object [object Object] has no method 'calendricalDate'

我正在尝试使用这个plugin。奇怪的是它一直在工作,但突然停止了。 这是 jQuery 代码:

<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js' type='text/javascript'></script>
<script src="../js/jquery.calendrical.js"></script>
<script>
    $(function() {
        $('#salida, #llegada').calendricalDate();
        $('#salida_time, #llegada_time').calendricalTime();
    });
</script>

和网站上的js文件一模一样,我只是复制粘贴。这可能是我可能忽略的一些非常愚蠢的事情,所以任何帮助都非常感激。 这是更详细的错误:

14Uncaught TypeError: Object [object Object] has no method 'calendricalDate'
(anonymous function)              enviotracking.php:14
o.extend.ready.o.readyList        jquery-1.3.2.min.js:19
o.extend.each                     jquery-1.3.2.min.js:12
o.extend.ready                    jquery-1.3.2.min.js:19
o.each.o.fn.(anonymous function)

php 文件的第 14 行是 DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">

好吧,这很奇怪我有另一个页面,它具有相同的代码并且它可以工作,但是我对错误发生的时间进行了细分,所以我把所有东西都拿出来并开始一个一个地添加我的代码,当我添加这个时我注意到了:

<script src="../js/jquery-1.6.1.min.js" type="text/javascript"></script>
<script type="text/javascript">
    $(document).ready(function(){

        $("ul.subnav").parent().append("<span></span>"); //Only shows drop down trigger when js is enabled (Adds empty span tag after ul.subnav*)

        $("ul.topnav li span").click(function() { //When trigger is clicked...

            //Following events are applied to the subnav itself (moving subnav up and down)
            $(this).parent().find("ul.subnav").slideDown('fast').show(); //Drop down the subnav on click

            $(this).parent().hover(function() {
            }, function(){
                $(this).parent().find("ul.subnav").slideUp('slow'); //When the mouse hovers out of the subnav, move it back up
            });

            //Following events are applied to the trigger (Hover events for the trigger)
            }).hover(function() {
                $(this).addClass("subhover"); //On hover over, add class "subhover"
            }, function(){  //On Hover Out
                $(this).removeClass("subhover"); //On hover out, remove class "subhover"
        });

    });
</script>

是我的代码中断的时候。但这不会发生在其他任何地方:(

【问题讨论】:

  • 检查 firebug 控制台是否有任何 javascript 错误
  • 你确定 jquery 版本,因为在 example.html 的插件站点上使用了 jquery 的 version 1.4.2
  • 我也试过 1.4.2 和同样的错误。 @3nigma in chrome 那是我假设 firebug 相同的确切错误消息?
  • 你确定相对路径“../js/jquery.calendrical.js”是正确的吗?
  • @DidierG。是的,我没有更改任何文件的路径。我以为就是这样,但没有一切都正确链接。我还检查了dreamweaver,你知道当你链接一些东西时它会给你一个标签,这样你就可以在不打开文件本身的情况下看到它。

标签: jquery


【解决方案1】:

为了关闭它,我发现它不是路径,而是另一个导致冲突的 jquery 脚本。而且我什至不需要它,在删除额外的脚本后一切正常。感谢大家的努力!

【讨论】:

    【解决方案2】:

    单独申请有效:

    试试这个:

    $('#salida').calendricalDate();
    $('#llegada').calendricalDate();
    

    【讨论】:

    • 算了,现在还早,你也可以:jsfiddle
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-05-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多