Jquery UI Datepicker not displaying

前端 未结 21 1186
半阙折子戏
半阙折子戏 2020-12-05 18:10

UPDATE
I have reverted back to Jquery 1.3.2 and everything is working, not sure what the problem is/was as I have not changed anything else apart of t

21条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-05 18:32

    I was having the same problem, and I found that in my case the cause was the datepicker div for some reason is retaining the class .ui-helper-hidden-accessible, which has the following CSS:

    .ui-helper-hidden-accessible {
     position: absolute !important;
     clip: rect(1px 1px 1px 1px);
     clip: rect(1px,1px,1px,1px);
    }
    

    I'm using the google CDN hosted versions of jquery, so I couldn't modify the code or the CSS. I had also tried changing the z-index without any success. The solution that worked for me was to set the clip property for the datepicker back to its default value, auto:

    $('.date').datepicker();
    $('#ui-datepicker-div').css('clip', 'auto');
    

    Since this specifically targets the datepicker div, there's less of a chance of unintended side effects on other widgets than changing the ui-helper-hidden-accessible class as a whole.

提交回复
热议问题