开发者

How can I disable keyboard shortcuts for jQuery UI date selector?

开发者 https://www.devze.com 2022-12-21 05:34 出处:网络
I\'m having a problem with the jQuery UI date selector, where when manually changing the date and hitting the enter key, the date selector date overrides the ma开发者_运维知识库nual entry (the action

I'm having a problem with the jQuery UI date selector, where when manually changing the date and hitting the enter key, the date selector date overrides the ma开发者_运维知识库nual entry (the action I'm going for is a form submit).

I'd like to disable the keyboard shortcuts on the date selector, but haven't been able to find a way.


As an option, you can try to override that behaviour by assigning another keydown event handler to your input after datepicker initialization, and check for enter key there

$('#your_input_id').keydown(function(e){
    if(e.which == 13) { 
      $('#your_form_id').submit();
      return false;
    }
});
0

精彩评论

暂无评论...
验证码 换一张
取 消