Jquery UI Datepicker not displaying

前端 未结 21 1122
半阙折子戏
半阙折子戏 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:28

    I had the same problem using JQuery-UI 1.8.21, and JQuery-UI 1.8.22.

    Problem was because I had two DatePicker script, one embedded with jquery-ui-1.8.22.custom.min.js and another one in jquery.ui.datepicker.js (an old version before I upgrade to 1.8.21).

    Deleting the duplicate jquery.ui.datepicker.js, resolve problem for both 1.8.21 and 1.8.22.

    0 讨论(0)
  • 2020-12-05 18:28

    Had the same problem that the datepicker-DIV has been created but didnt get filled and show up on click. My fault was to give the input the class "hasDatepicker" staticly. jQuery-ui hat to set this class by its own. then it works for me.

    0 讨论(0)
  • 2020-12-05 18:29

    This may be helpful to someone. If you copied and pasted your form data (which has the datepicker input box, ensure you do not inadvertently copy the class="hasDatepicker"

    This means your input box should look like this:

    <input id="dateChooser" name="dateChooser" type="text" value=""/>
    

    NOT

    <input id="dateChooser" name="dateChooser" type="text" value="" class="hasDatepicker">
    

    I made that mistake inadvertently. Removing the class and allowing the jQuery UI call appeared to fix it.

    Hope that helps someone!

    0 讨论(0)
  • 2020-12-05 18:30

    Please make sure that you are using the same version of jquery-ui 'js' and 'css' files. Sometimes that could be a problem.

    0 讨论(0)
  • 2020-12-05 18:31

    I have found a trick solution. You can use the below codes.

    $(".datepicker").datepicker({
    /* any options you want */
    beforeShowDay: function (date) {
        $('#ui-datepicker-div').css('clip', 'auto');
        return [true, '', ''];
        }
    });
    
    0 讨论(0)
  • 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.

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