jQuery ui - datepicker prevent refresh onSelect

前端 未结 5 1277
一整个雨季
一整个雨季 2020-12-17 20:09

I\'m using jQuery ui Datepicker to display a yearly inline calendar full of \"special dates\" (with colors). \"enter

5条回答
  •  时光说笑
    2020-12-17 20:33

    I have almost the same problem, like some other people, I have some kind of a solution.... but it's not fair:

    $('#calendar').datepicker({
    ...,
    onSelect: function (selectedDate, inst) 
    {
      myFunction(selectedDate, inst);
    }
    });
    function myFunction(selectedDate, inst)
    {
    
      $('.date_pick').toggleClass('focused');
      if ($('.date_pick.end').hasClass('focused')) {
        $('.date_pick.end').val('');
      }
      inst.preventDefault(); # aa; works too, but writing aa; is going too far xD
    }
    

    It is not perfect, but works... I'll try to make it works just fine, till then...

    EDIT: Solved adding:

    
    

提交回复
热议问题