我正在使用jQuery 简单的时间选择器(只是时间选择器而不是日期时间选择器),但我无法显示它。我正在使用 modx 1.0.6 evolution 并通过块将时间选择器添加到选择加入表单中。
这是选择加入表单代码:
<div><input type="text" name="basic_example_2" id="basic_example_2" value="" /></div>
这是我的页面标题,我已经修改了所有 jQuery 文件应该在的位置,并且还使用 JSlint 检查了 jQuery 代码,它说没关系:
<head>
<title>[(site_name)] | [*pagetitle*]</title>
<meta http-equiv="Content-Type" content="text/html; charset=[(modx_charset)]" />
<base href="[(site_url)]"></base>
<link rel="stylesheet" href="assets/templates/landing-page/layout.css" type="text/css" media="screen" />
<link rel="stylesheet" href="assets/templates/landing-page/modxmenu.css" type="text/css" media="screen" />
<link rel="stylesheet" href="assets/templates/landing-page/form.css" type="text/css" media="screen" />
<link rel="stylesheet" href="assets/templates/landing-page/modx.css" type="text/css" media="screen" />
<link rel="stylesheet" href="assets/templates/landing-page/print.css" type="text/css" media="print" />
<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="[(site_url)][~11~]" />
<link rel="stylesheet" media="all" type="text/css" href="http://code.jquery.com/ui/1.8.23/themes/smoothness/jquery-ui.css" />
<link rel="stylesheet" media="all" type="text/css" href="assets/templates/landing-page/jquery-ui-timepicker-addon.css" />
<script src="manager/media/script/mootools/mootools.js" type="text/javascript"></script>
<script src="assets/templates/modxhost/drop_down_menu.js" type="text/javascript"></script>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/ui/1.8.24/jquery-ui.min.js"></script>
<script type="text/javascript" src="assets/templates/landing-page/jquery-ui-timepicker-addon.js"></script>
<script type="text/javascript" src="assets/templates/landing-page/jquery-ui-sliderAccess.js"></script>
<script>
$(function() {
$( "#datepicker" ).datepicker({showAnim: 'slideDown'});
});
</script>
<script>
$('#basic_example_2').timepicker();
</script>
</head>
我试过这个:
$('#basic_example_2').timepicker({});
还有这个:
$(function() {
$('#basic_example_2').timepicker({});
});
还有这个:
$('#basic_example_2').timepicker();
以防万一我认为它不应该重要,但是 CSS 已添加到我的 layout.css 文件中:
.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; }
.ui-timepicker-rtl{ direction: rtl; }
.ui-timepicker-rtl dl { text-align: right; }
.ui-timepicker-rtl dl dd { margin: 0 65px 10px 10px; }