JQuery UI Datepicker loses focus when selecting date with mouse

后端 未结 10 1547
情歌与酒
情歌与酒 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:51

    If you really don't care about the tab order, that is, not having it assigned so it follows the flow of the page, you could do something like this.

    jQuery('.date').datepicker({
        'onSelect': function(){
            $(this).nextAll('input, button, textarea, a').filter(':first').focus();
        }
    });
    

    It works on the assumption that when the user selects the date, he is finished with that field and moves on to the next one, so it simply selects the next field.

提交回复
热议问题