jQuery UI datepicker: Configure keyboard shortcuts

前端 未结 4 569
隐瞒了意图╮
隐瞒了意图╮ 2021-02-07 17:56

I use the jQuery UI datepicker to let the user select a date. It has some shortcuts so that it can be controlled using the keyboard:

page up/down      - previous         


        
4条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-07 18:27

    This is not configurable through datepicker. You would have to change the _doKeyDown method source here.

    The easiest way to do this would be to extend the widget. It would look something like this:

    $.extend($.datepicker, {
         _doKeyDown: function(event){
               //copy original source here with different
               //values and conditions in the switch statement
         }
    });
    

提交回复
热议问题