Jquery datepicker - only day and month

柔情痞子 提交于 2019-11-27 05:06:39

set the css to hide the year and the dateFormat as K6t said

.ui-datepicker-year{
    display:none;
}

You could do:

$('#date').datepicker( {
        changeMonth: true,
        changeYear: true,
        showButtonPanel: true,
        dateFormat: 'dd MM'
    });

fiddle http://jsfiddle.net/u8GnD/1/

You can hide year from a datepicker like this :

$(".daypicker").datepicker( { 
    changeYear: false, 
    dateFormat: 'MM-dd',
}).focus(function () {
    $(".ui-datepicker-year").hide();
});

It wont affect to other datepickers in same page.

$("#datepicker").datepicker( {
format: "dd-MM",
viewMode: "months", 
maxViewMode: "months"
});

this will surely hide year from datepicker view, will show only month and days panel

$( function() {
     var date = $('#datepicker').datepicker({
        dateFormat: 'yy-mm-dd',
        changeMonth: true, 
        changeYear: false}).val();
});

change dateFormat as

dateFormat: 'dd MM',

in datePicker.js file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!