jquery ui datepicker IE reload or jumps to the top of the page

前端 未结 2 1544
鱼传尺愫
鱼传尺愫 2021-01-12 18:01

I am noticing this issue in IE 7 + 8

$(\'#event-start-date\').datepicker({dateFormat:\'DD MM dd yy\',minDate:\'-0d\'});

When you pick the d

2条回答
  •  暖寄归人
    2021-01-12 18:36

    I have the same problem with FF 3.6.13, Jquery 1.5.0 delivered from the jquery CDN and jqueryui 1.8.9.

    Extremely oddly, its only happening on SOME computers with the same version of firefox, with caches cleared.

    This fix worked for me though. i.e.

    $(".datepicker").datepicker({
      dateFormat: "yy-mm-dd",
      changeMonth: true,
      changeYear: true,
      numberOfMonths: 2,
      showButtonPanel: true,
      onSelect: function() {
        $(".ui-datepicker a").removeAttr("href");
      }
    });
    

    The only issue is it now ignores the .change event. I fixed this by adding $(this).change():

    $(".datepicker").datepicker({
      dateFormat: "yy-mm-dd",
      changeMonth: true,
      changeYear: true,
      numberOfMonths: 2,
      showButtonPanel: true,
      onSelect: function() {
        $(".ui-datepicker a").removeAttr("href");
        $(this).change();
      }
    });
    
    $(".date_unix").datepicker({
      dateFormat: "@",
      changeMonth: true,
      changeYear: true,
      numberOfMonths: 2,
      showButtonPanel: true,
      onSelect: function() {
        $(".ui-datepicker a").removeAttr("href");
        $(this).change();
      }
    });
    

提交回复
热议问题