文本框重新关注时间戳关闭 [英] Textbox gets back focus upon timepicker close

查看:109
本文介绍了文本框重新关注时间戳关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 jquery的timepicker插件

一旦用户选择日期+时间并点击完成按钮,基本上只关闭对话框,我希望设置datetime的文本框获得后焦点(插件的当前行为是模糊焦点)。

Once users selected a date+time and click on the "Done" button, which basically just closes the dialog, I want the textbox where datetime is set to gain back focus (the current behavior of the plugin is to blur out focus).

这是因为在这个页面上我有一组文本框,它们的标签顺序是按顺序设置的。我需要日期时间文本框来获得后焦距以继续Tab键顺序。否则标签顺序将从第一个文本输入重新开始,这对用户来说是不方便的。

This is because on this page I have a set of textboxes and their tab orders are set sequentially. I need the datetime textbox to gain back focus to continue the tab order. otherwise the tab order will restart from the first text input which is inconvenient for the user.

推荐答案

描述



假设我理解你的问题,你可以在 onClose 事件中将焦点设置到你的文本框。如果这不是正确答案,请提供更多信息。 html 或者更好 jsFiddle 会很棒。

Description

Assuming i understand your question, you can set the focus to your textbox in the onClose event. Please provide more information if this is not the right answer. html or better a jsFiddle would be great.

$('#MyDatepicker').datetimepicker({
    onClose: function(dateText, inst) {
       $('#MyDatepicker').focus();
    }
});



更多信息




  • jQuery.focus()

  • More Information

    • jQuery.focus()
    • 如果你有几个datePickers,你可以这样做。

      If you have several datePickers you can do this.


      1. 给他们所有相同的CSS课程。

      2. 这样做

      1. Gave them all the same css class.
      2. Do this

          $('.MyDatePickerClass').datetimepicker({
              onClose: function(dateText, inst) {
                 $('.MyDatePickerClass').focus();
              }
          });
      


      这篇关于文本框重新关注时间戳关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆