Stop jquery-ui datepicker from showing in beforeShow

后端 未结 6 1965
不知归路
不知归路 2021-01-13 13:10

I wish to do something like this:

var showme = false;

$(\'#mydatepicker\').datepicker({
    beforeShow: function(input, inst) {
        if(!showme) {
               


        
6条回答
  •  北荒
    北荒 (楼主)
    2021-01-13 14:09

    Seems to be the closest I could get too, but I don't really want to have to use setTimeout here, it seems a bit hacky:

            var showme = false;
    
            $('#mydatepicker').datepicker({
                beforeShow: function (input, inst) {
    
                    if (!showme) {
    
                        setTimeout(function () { $(input).datepicker("hide"); }, 1);
    
                    }
                }
            });
    

提交回复
热议问题