我在页面中使用了jQuery中的datepicker,它运行正常:
<head>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.0/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.0/jquery-ui.js"></script>
<script>
$( function(){
$("#startdate").datepicker({dateFormat: 'yy-mm-dd'});
} );
$( function(){
$("#enddate").datepicker({dateFormat: 'yy-mm-dd'});
} );
</script>
</head>
<body>
<form action="" method="post">
From Date-Time:<br>
<input type="text" id="startdate" name="startdate" value="">
<br>
To Date-Time:<br>
<input type="text" id="enddate" name="enddate" value="">
</body>
现在我想为它添加时间。我搜索过&amp;在jQuery“datetimepicker”中下载了相同但无法使其工作。
<head>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.0/themes/base/jquery-ui.css">
<link rel="stylesheet" href="jquery.datetimepicker.css">
<script src="jquery.datetimepicker.js"></script>
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.0/jquery-ui.js"></script>
<script>
$( function(){
$("#startdate").datetimepicker({dateFormat: 'yy-mm-dd'});
} );
$( function(){
$("#enddate").datetimepicker({dateFormat: 'yy-mm-dd'});
} );
</script>
</head>
<body>
<form action="" method="post">
From Date-Time:<br>
<input type="text" id="startdate" name="startdate" value="">
<br>
To Date-Time:<br>
<input type="text" id="enddate" name="enddate" value="">
</body>
请告知,纠正措施应该是什么。
答案 0 :(得分:0)
尝试在导入datetime picker js
之前导入jquery<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.0/jquery-ui.js"></script>
<script src="jquery.datetimepicker.js"></script>
答案 1 :(得分:0)
添加“js / jquery.datetimepicker.full.js”后问题解决了
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.0/themes/base/jquery-ui.css">
<link rel="stylesheet" href="css/jquery.datetimepicker.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.0/jquery-ui.js"></script>
<script src="js/jquery.datetimepicker.full.js"></script>