本文介绍了datetimepicker 不是函数 jquery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 datetimepicker jquery ui,当代码低于 html 时,datetimepicker 未显示,当我使用 firebug 控制台 检查时,它显示错误``

I working with datetimepicker jquery ui, when code below html , datetimepicker is not displaying and when i inspect with firebug console it displayed an error ``

$("#example1").datetimepicker is not a function
[Break On This Error] $("#example1").datetimepicker();

下面是代码

<link href="css/styles.css" rel="stylesheet" type="text/css">
<link href="css/jquery-ui-1.8.16.custom.css" rel="stylesheet" type="text/css">

<style>
    .ui-timepicker-div .ui-widget-header { margin-bottom: 8px; }

    .ui-timepicker-div dl { text-align: left; }
    .ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; }
    .ui-timepicker-div dl dd { margin: 0 10px 10px 65px; }
    .ui-timepicker-div td { font-size: 90%; }
    .ui-tpicker-grid-label { background: none; border: none; margin: 0; padding: 0; }

</style>


<script type="text/javascript" src="scripts/jquery.js"></script>

<script type="text/javascript" src="scripts/jquery/ui/jquery.ui.datepicker.js"></script>
<script type="text/javascript" src="scripts/jquery/ui/jquery-ui-1.8.16.custom.min.js"></script>
<script type="text/javascript" src="scripts/jquery/ui/jquery-ui-timepicker-addon.js"></script>
<script type="text/javascript" src="scripts/jquery/ui/jquery-ui-sliderAccess.js"></script>

<script>
    $(document).ready(function(){
        $("#example1").datetimepicker();
    });
</script>

<script>

</script>

<input type="text" id="example1" class="hasDatePicker">

推荐答案

请记住,jQuery UI 的日期选择器未使用 datetimepicker() 进行初始化,此处似乎有一个插件/插件:http://trentrichardson.com/examples/timepicker/.

Keep in mind, the jQuery UI's datepicker is not initialized with datetimepicker(), there appears to be a plugin/addon here: http://trentrichardson.com/examples/timepicker/.

然而,仅使用 jquery-ui,它实际上被初始化为 $("#example").datepicker().在此处查看 jQuery 的演示站点:http://jqueryui.com/demos/datepicker/

However, with just jquery-ui it's actually initialized as $("#example").datepicker(). See jQuery's demo site here: http://jqueryui.com/demos/datepicker/

   $(document).ready(function(){
        $("#example1").datepicker();
    });

要在上面引用的链接中使用 datetimepicker,您需要确定您的脚本路径对于插件是正确的.

To use the datetimepicker at the link referenced above, you will want to be certain that your scripts path is correct for the plugin.

这篇关于datetimepicker 不是函数 jquery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 03:14
查看更多