JQuery UI Datepicker loses focus when selecting date with mouse

后端 未结 10 1704
情歌与酒
情歌与酒 2021-02-01 02:16

I am using JQuery ui with datepicker and when a user tabs on to a field, they appropriately get the calendar pop up.

  1. User tabs (via key onto field
  2. User s
10条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-01 02:34

    Subscribe to the onClose or the onSelect event:

    $("#someinput").datepicker(
    {
        // other options goes here
        onSelect: function ()
        {
            // The "this" keyword refers to the input (in this case: #someinput)
            this.focus();
        }
    });
    

    Or in the case of onClose:

    $("#someinput").datepicker(
    {
        onClose: function ()
        {
            this.focus();
        }
    });
    

提交回复
热议问题