【问题标题】:Keyboard Tab focus键盘选项卡焦点
【发布时间】:2014-10-01 01:10:10
【问题描述】:

我在 Jasny 引导程序中使用文件输入。一切都很好,除了键盘选项卡焦点字段没有突出显示。请给我一个解决方案。 谢谢

【问题讨论】:

    标签: twitter-bootstrap jasny-bootstrap


    【解决方案1】:

    您必须做两件事:使“按钮”(它们是跨度)可聚焦并绑定keypress 事件以单击隐藏的输入。 我真的不擅长 javascript,所以这可以做得更好,但它目前对我有用:

      $('.fileinput .btn').each(function(){
        if ($(this).attr('tabindex') === undefined) { // if it hasn't tabindex
          $(this).attr('tabindex', 0);
        }
        $(this).on('keypress', function(e){
          if ( e.which == 13 ) { // only works with enter key
            $(this).children('input').click();
          }
        });
      });
    

    请修正我的英语和我的代码,我用它们来工作:D

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-12-26
      • 2020-03-22
      • 2021-12-07
      • 2014-07-05
      • 2011-03-22
      • 1970-01-01
      • 2021-05-24
      • 1970-01-01
      相关资源
      最近更新 更多