Jquery datepicker - only day and month

后端 未结 6 1183
灰色年华
灰色年华 2020-11-30 11:33

I want the user to specify their birthday or anniversary date (without year) in a form. For this, I want to use jquery datepicker but it should not show any year option at a

相关标签:
6条回答
  • 2020-11-30 11:53

    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.

    0 讨论(0)
  • 2020-11-30 12:03

    You could do:

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

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

    0 讨论(0)
  • 2020-11-30 12:08

    change dateFormat as

    dateFormat: 'dd MM',
    

    in datePicker.js file

    0 讨论(0)
  • 2020-11-30 12:10
    $("#datepicker").datepicker( {
    format: "dd-MM",
    viewMode: "months", 
    maxViewMode: "months"
    });
    

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

    0 讨论(0)
  • 2020-11-30 12:11
    $( function() {
         var date = $('#datepicker').datepicker({
            dateFormat: 'yy-mm-dd',
            changeMonth: true, 
            changeYear: false}).val();
    });
    
    0 讨论(0)
  • 2020-11-30 12:14

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

    .ui-datepicker-year{
        display:none;
    }
    
    0 讨论(0)
提交回复
热议问题