在jQuery UI Datepicker中交换月/年选择列表位置
Swap month/year select list placement in jQuery UI Datepicker
我想在启用了changeYear和changeMonth选项的日期选择器中交换月份/年份选择元素的位置。
默认情况下显示顺序是月然后年,我想要年然后月。
运行下面的代码片段,看看为什么:
$( "#picker" ).datepicker({
maxDate: 'today',
changeYear: true,
changeMonth: true,
minDate: "01/01/1939",
stepMonths:12,
yearRange: "1939:" + new Date().getFullYear()
});
<link rel="stylesheet" type="text/css" href="https://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css" />
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<script src="https://code.jquery.com/ui/1.11.4/jquery-ui.min.js"></script>
<form>
<div><b>How do I swap the month/year select list placement?</b></div>
Birthdate: <input type="text" name="picker" id="picker" value="" />
<ol>
<li>Click the input above to open the datepicker.</li>
<li>Click on the month select list to view the select options available.</li>
<li>Notice that it only shows up to the current month? This is confusing to users.</li>
<li>Change the year to any previous one.<li>
<li>Now select a month, they are all there.</li>
<li>In our world of left to right processing, in this case, it makes sense to have the year appear first followed by the month.</li>
</ol>
</form>
使用CSS:
将月份和年份向右浮动.ui-datepicker select.ui-datepicker-month,
.ui-datepicker select.ui-datepicker-year { float: right; }
或者按照重复的答案所提供的:使用选项showMonthAfterYear: true
相关文章:
- Angular:使用选择列表选择过滤代码中的对象
- 在Twitter BootStrap嵌套下拉列表中托管一个选择列表(IE 9特定)
- Jquery不允许来自多个选择列表的相同值
- 谷歌表单-根据分配给谷歌应用程序的工作为商业用户预先填充多项选择列表
- 如何修剪表单'提交'多级选择列表的值
- 使用jQuery获取选择列表中每个更改的值
- Javascript/Jquery将选择列表更改为单选按钮
- 动态填充的选择列表
- jqgrid动态加载选择列表
- 使用peta poco ORM在MVC应用程序中创建选择列表
- 我正在尝试从 xhtml 文件中动态提取所有
元素,并使用 javascript 将它们放入选择列表中
- JQuery无法找到选择列表
- 我正试图动态地拉动<h3>元素,并将它们放在选择列表中
- 根据预选,用值填充选择列表
- 在PHP中将下拉选择列表的内容从一个表单传递到另一个表单
- 我已经创建了一个动态的下拉选择列表,它指向一行;如何使该行成为变量
- 允许用户订购选择列表
- 动态选择列表AJAX和插入数据库表通过张贴形式
- 使用jQuery的层次选择列表
- 如何在选择列表项时重新加载iframe