jquery date picker but day month and year in separate dropdowns

前端 未结 2 608
孤城傲影
孤城傲影 2021-01-13 05:45

I am working on a jquery date picker. I need to select a date but after date selection from the calendar I need the date to divide into three separate drop downs. One for d

2条回答
  •  天涯浪人
    2021-01-13 06:18

    Use the datepicker onselect method to get the date values you need :: onselect info

    Like:

    onSelect: function(dateText, inst) {            
            var datePieces = dateText.split('/');
            var month = datePieces[0];
            var day = datePieces[1];
            var year = datePieces[2];
            //define select option values for
            //corresponding element
            $('select#month').val(month);
            $('select#day').val(day);
            $('select#year').val(year);
    
    }
    

    Did you mean something like that

提交回复
热议问题