getDate with Jquery Datepicker

后端 未结 5 1349
礼貌的吻别
礼貌的吻别 2020-12-05 14:45

i am trying to get date from my implementation of jquery date picker, add it to a string and display the resulting image in my div. Something however is just not working. Ca

5条回答
  •  伪装坚强ぢ
    2020-12-05 15:24

    Instead of parsing day, month and year you can specify date formats directly using datepicker's formatDate function. In my example I am using "yy-mm-dd", but you can use any format of your choice.

    $("#datepicker").datepicker({
        dateFormat: 'yy-mm-dd',
        inline: true,
        minDate: new Date(2010, 1 - 1, 1),
        maxDate: new Date(2010, 12 - 1, 31),
        altField: '#datepicker_value',
        onSelect: function(){
            var fullDate = $.datepicker.formatDate("yy-mm-dd", $(this).datepicker('getDate'));
            var str_output = "



    "; $('#page_output').html(str_output); } });

提交回复
热议问题