目前我正在使用bootstrap supr theme
开展项目。默认情况下,它是在js文件之后加载的:
bootstrap.js
colorpicker.js, date.js, elfinder.min.js, fullcalendar, iosorientation, jpages.min, jquery-ui, jquery-cookie, jquery-datatable, jquery-duallistbox, jquery-elastic, jquery-ibutton, jquery-imputlimiter, jquery, jquery-knob, jquery-lazyload, jquery-min, jquery-ui.button, jquery-ui.button, responsivetable, timepicker-addon etc.
每当在页面中,当我在使用代码的页面中使用timepicker时
$(document).ready(function() {
$("#AcAppointments_start_time").timepicker({
ampm: true,
timeFormat: 'hh:mm TT',
stepMinute: 5,
});
$("#AcAppointments_end_time").timepicker({
ampm: true,
timeFormat: 'hh:mm TT',
stepMinute: 5,
});
});
在控制台中我收到错误Uncaught TypeError: Object [object Object] has no method 'timepicker'
出现此错误的可能原因可能是什么?
更新:
包括js
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/js/supr/jquery.min.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/js/supr/bootstrap/bootstrap.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/js/supr/jquery.cookie.js"></script>
<!-- Load plugins -->
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/plugins/qtip/jquery.qtip.min.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/plugins/sparkline/jquery.sparkline.min.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/plugins/knob/jquery.knob.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/plugins/fullcalendar/fullcalendar.min.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/plugins/prettify/prettify.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/plugins/watermark/jquery.watermark.min.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/plugins/elastic/jquery.elastic.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/plugins/inputlimiter/jquery.inputlimiter.1.3.min.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/plugins/maskedinput/jquery.maskedinput-1.3.min.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/plugins/ibutton/jquery.ibutton.min.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/plugins/uniform/jquery.uniform.min.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/plugins/stepper/ui.stepper.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/plugins/color-picker/colorpicker.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/plugins/timeentry/jquery.timeentry.min.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/plugins/select/select2.min.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/plugins/dualselect/jquery.dualListBox-1.3.min.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/plugins/tiny_mce/jquery.tinymce.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/plugins/validate/jquery.validate.min.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/plugins/animated-progress-bar/jquery.progressbar.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/plugins/pnotify/jquery.pnotify.min.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/plugins/lazy-load/jquery.lazyload.min.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/plugins/jpages/jPages.min.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/plugins/pretty-photo/jquery.prettyPhoto.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/plugins/smartWizzard/jquery.smartWizard-2.0.min.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/plugins/touch-punch/jquery.ui.touch-punch.min.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/plugins/ios-fix/ios-orientationchange-fix.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/plugins/dataTables/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/plugins/elfinder/elfinder.min.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/plugins/plupload/plupload.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/plugins/plupload/plupload.html4.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/plugins/plupload/jquery.plupload.queue/jquery.plupload.queue.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/plugins/responsive-tables/responsive-tables.js"></script>
<!-- Important Place before main.js -->
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/js/supr/jquery-ui.min.js"></script>
<script src="<?php echo Yii::app()->request->baseUrl; ?>/js/supr/js/jquery-ui-timepicker-addon.js" type="text/javascript"></script>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/js/supr/main.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/js/supr/appointpressjs.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/js/bootstrap-tooltip.js"></script>
答案 0 :(得分:0)
您是否在此代码块之前和UI核心js之后包含了timepicker.js(无论如何)?基本上你需要先为timepicker.js添加依赖项,然后是timepicker js本身,然后是代码块。感谢。
答案 1 :(得分:0)
浏览器控制台告诉您浏览器无法找到timepicker插件。 这意味着您没有正确地包含timepicker插件。
据我所知,bootstap中没有timepicker组件。你应该使用一些3方插件。 像这样http://jdewit.github.io/bootstrap-timepicker/
检查脚本文件夹中是否存在timepicker脚本。 连接引导脚本
后,检查是否已添加带时间戳的脚本标记