Set focus on Jquery datepicker on datepicker close, without opening datepicker

社会主义新天地 提交于 2019-12-24 13:00:21

问题


I am trying to set focus on input of datepicker, after datepicker closes, but without opening it again.

Does anyone have a solution to this wicked request?

I have tried something like this, but finally I cant get it to work for IE9.

$.datepicker.setDefaults({
            onClose: function(dateText, inst) { 
               showDatepicker = false;

               if (detectIE()) {
                 $(this).focus();
               } else {
                 setTimeout(function() {
                   $(this).focus();
                 })
               } 
            },
            beforeShow: function() {
                if (!showDatepicker) {
                    showDatepicker = true;
                    return false;
                }
            }
        });

来源:https://stackoverflow.com/questions/33239135/set-focus-on-jquery-datepicker-on-datepicker-close-without-opening-datepicker

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!