datetimepicker不是函数jquery [英] datetimepicker is not a function jquery
问题描述
我使用datetimepicker jQuery ui,当html以下代码未显示datetimepicker时,当我用firebug console
检查时显示错误``
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的datepicker未使用datetimepicker()初始化,此处似乎有一个插件/附加组件:
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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!