jQuery trigger a DatePicker change event

后端 未结 2 1494
既然无缘
既然无缘 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 18:49

    just you have to use:

    $('.custom_datepicker_selector').datepicker({
    weekStart: 1,
    dateFormat:'yy-mm-dd'
    })
    

    you can reference here : link

    0 讨论(0)
  • 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.

    0 讨论(0)
提交回复
热议问题