gpt4 book ai didi

使用鼠标选择日期时,JQuery UI Datepicker 失去焦点

转载 作者:行者123 更新时间:2023-12-03 21:29:13 25 4
gpt4 key购买 nike

我正在使用带有日期选择器的 JQuery ui,当用户点击某个字段时,他们会相应地弹出日历。

  1. 用户选项卡(通过键入字段
  2. 用户通过鼠标点击选择日期
  3. 用户选项卡
  4. Tabindex 从 1 开始(在表单的开头)

这是代码。 (也可能设置选项卡索引)

<input type="text" name="demo" />
<input type="text" class="date" />

jquery 代码是:

$(".date").datepicker();

关于如何解决这个问题有什么建议(最短解决方案的奖励)?

最佳答案

订阅onCloseonSelect事件:

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

或者在onClose的情况下:

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

关于使用鼠标选择日期时,JQuery UI Datepicker 失去焦点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1401917/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com