JQuery日期选择器选择年份
我希望用户能够选择年份,而不必单击与月份相关的上一个或下一个选项卡。我怎样才能做到这一点。以下是我目前的代码:JQuery日期选择器选择年份,jquery,Jquery,我希望用户能够选择年份,而不必单击与月份相关的上一个或下一个选项卡。我怎样才能做到这一点。以下是我目前的代码: if ( $('[type="date"]').prop('type') != 'date' ) { $('[type="date"]').datepicker({ //Something here }); } 这是我的datepiker配置,我使用的是字体很棒的图标,所以我可以忽略它。你想要的是changeyear参数 $('#elementID').datepi
if ( $('[type="date"]').prop('type') != 'date' ) {
$('[type="date"]').datepicker({
//Something here
});
}
这是我的datepiker配置,我使用的是字体很棒的图标,所以我可以忽略它。你想要的是changeyear参数
$('#elementID').datepicker({
showOn: 'both',
buttonText: "<i class='fa fa-calendar fa-lg blue'></i>",
changeMonth: true,
changeYear: true
});
$('#elementID')。日期选择器({
showOn:“两者都有”,
按钮文本:“”,
变化月:对,
变化年:对
});
这很完美,但为什么月份和年份的选择如此广泛?它们似乎占据了整行。您可以执行f12并找出它们的css类,然后尝试覆盖width属性。year类似乎是ui datepicker year。这取决于你来决定投资回报是否值得。祝你好运