jQuery trigger a DatePicker change event

后端 未结 2 1493
既然无缘
既然无缘 2021-01-05 18:36

I have the following code:

$(\'.custom_datepicker_selector\').datepicker({
  weekStart: 1
})
.on(\'changeDate\', function(en) {
  var correct_format;
  corre         


        
2条回答
  •  说谎
    说谎 (楼主)
    2021-01-05 19:16

    You can define the default date format also.

    Try this out:

    $('.custom_datepicker_selector').datepicker({
      weekStart: 1,
      dateFormat: 'dd/mm/yy'
    }).on('changeDate', function(en) {
          $('.custom_datepicker_selector').datepicker('hide');
          return $(this).parent().find("input[type=hidden]").val(en);
       });
    

    UPDATE : (important)

    I have seen your JSFiddle, you have kept the default value of the textbox as value="2013-02-17" that's why it shows that value at start just remove it.

提交回复
热议问题