简体   繁体   English

jQuery Datepicker选择年份

[英]JQuery Datepicker selecting year

I wish for the user to be able to select the year without having to click on the prev or next tab relating to months. 我希望用户能够选择年份,而不必单击与月份有关的上一个或下一个选项卡。 How can I accomplish this. 我该怎么做。 Here is my code so far: 到目前为止,这是我的代码:

if ( $('[type="date"]').prop('type') != 'date' ) {
    $('[type="date"]').datepicker({
    //Something here

});
}

this is my configuration of datepiker I use font awesome icon so just igonore that. 这是我对datepiker的配置,我使用了真棒字体图标,所以就这么简单。 what you want is the changeyear param. 您想要的是changeyear参数。

$('#elementID').datepicker({ 
    showOn: 'both',
    buttonText: "<i class='fa fa-calendar fa-lg blue'></i>",
    changeMonth: true,
    changeYear: true
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM