【发布时间】:2015-01-01 05:20:51
【问题描述】:
如何显示日期选择器或如何将其限制为仅显示指定月份?只能说 11 月或 2 月。
【问题讨论】:
-
搜索时发现了什么?
-
没有找到任何东西@mitchwheat
标签: jquery jquery-ui jquery-plugins jquery-ui-datepicker
如何显示日期选择器或如何将其限制为仅显示指定月份?只能说 11 月或 2 月。
【问题讨论】:
标签: jquery jquery-ui jquery-plugins jquery-ui-datepicker
您可以使用defaultDate 设置默认月份。 http://jqueryui.com/datepicker/
$(function() {
var d = new Date();
d.setMonth(1); //Defalt month feburary
$( "#datepicker" ).datepicker({
defaultDate: d
});
});
【讨论】:
这里你只能在 JQuery 日期选择器中看到一个月:
以下代码:
<html>
<head>
<meta charset="utf-8">
<title>jQuery UI Datepicker - Default functionality</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css">
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script src="http://code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
<link rel="stylesheet" href="http://jqueryui.com/resources/demos/style.css">
<script>
$(function() {
$( "#datepicker" ).datepicker();
});
</script>
</head>
<body>
<p>Date: <input type="text" id="datepicker"></p>
</body>
</html>
在此处显示不同的选项:
【讨论】: