jQuery timepicker不起作用

时间:2010-10-27 17:07:43

标签: jquery jquery-ui jquery-plugins

我似乎无法让我的jQuery时间选择器工作。单击输入框时没有任何反应。知道我做错了吗?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>

<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.5.custom.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-timepicker-addon.min.js"></script> 

<link rel="stylesheet" href="css/redmond/jquery-ui-1.8.5.custom.css" type="text/css" title="ui-theme" />

<script type="text/javascript">
$(function(){

        $('#errorDate').datepicker();
});

</script>
<style>
.ui-timepicker-div .ui-widget-header{ margin-bottom: 8px; }
.ui-timepicker-div dl{ text-align: left; }
.ui-timepicker-div dl dt{ height: 25px; }
.ui-timepicker-div dl dd{ margin: -25px 0 10px 65px; }
.ui-timepicker-div .ui_tpicker_hour div { padding-right: 2px; }
.ui-timepicker-div .ui_tpicker_minute div { padding-right: 6px; }
.ui-timepicker-div .ui_tpicker_second div { padding-right: 6px; }
.ui-timepicker-div td { font-size: 90%; }
</style>
</head>

<body>
<input type="text" id="errorDate" name="errorDate" class="hasDatepicker">
</body>
</html>

2 个答案:

答案 0 :(得分:1)

当我从您的输入中删除class =“hasDatepicker”时,它似乎开始工作。

答案 1 :(得分:0)

我相当确定所有jQuery ui小部件都需要jquery.ui.core.min.js的引用,包括datepicker

<script type="text/javascript" src="js/jquery.ui.core.min.js"></script>