$ .datepicker未定义 [英] $.datepicker not defined

查看:158
本文介绍了$ .datepicker未定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法哄骗datetimepicker正常工作. Datepicker可以正常工作.但是,经过大约7个小时的尝试,该插件无法正常工作.

I cannot coax the datetimepicker to work. Datepicker works fine. But the add-on has not worked after about 7 hours of attempts.

Firebug没有显示404.

Firebug shows no 404's.

主题框架还包括所有jQuery库.

All jQuery libraries are included with the theme framework as well.

我尝试在脚本中用jQuery.datepicker替换$ .datepicker的所有实例.这没什么区别.

I tried replacing all instances of $.datepicker with jQuery.datepicker in the script. This made no difference.

我尝试将脚本上移或下移或组合.相同的错误仍然存​​在.我已经在这个论坛中检查了几个相关的答案,还有很多其他的答案都无济于事.我已经查看了jQuery文献,但没有解决这个特定问题.

I tried moving scripts above or below or combining them. The same error persists. I have examined several related answers in this forum and many, many others to no avail. I have reviewed jQuery literature but it does not address this specific problem..

我的代码是这个.只是几个html输入. Datepicker可以正常工作.

My code is this. Just a couple of html inputs. Datepicker works fine.

   `jQuery(document).ready(function(){
    jQuery('#datepicker').datepicker();
});

jQuery(document).ready(function(){
    jQuery('#datetime').datetimepicker();
});`

这段代码可以正常工作.然后,Datetimepicker上线

This segment of code works fine. Datetimepicker then hits the line

$.datepicker.parseDateTime = function(dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings) {

$.datepicker未定义.

$.datepicker not defined.

如果您不知道答案,也许javascript/jQuery有一种方法可以产生有关其失败的更详细的信息?

If you do not know the answer, perhaps there is a way for javascript/jQuery to produce more detailed information about its failures?

推荐答案

更改为此

jQuery(document).ready(function(){
        $.datepicker.parseDateTime = function(dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings){};
});

好像您正在尝试在函数加载之前调用它. jQuery将按顺序遍历每个doc.ready函数,因此只要在初始加载后它就可以正常工作.

Looks like you are trying to call the function before it gets loaded. Jquery will go through each doc.ready function in order, so as long as this is after the initial load it should work.

此外,请使用chrome内置的开发工具进行调试.在PC上按Ctrl-Shift-j即可打开它们,您可以查看控制台消息以了解发生了什么情况.

Also, use chrome's built in develop tools for debugging purposes. Ctrl-shift-j on a PC will open them up, you can see the console messages to figure out whats going on.

这里是一个jsfiddle,用于显示有效语法 http://jsfiddle.net/XA79k/

heres a jsfiddle to show the working syntax http://jsfiddle.net/XA79k/

这篇关于$ .datepicker未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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