STUDY WHILE YOU ARE BORING


  • 首頁

  • 搜索

  • 技术

  • Tags

  • 关于我

在网页上,让回车键(enter)模拟Tab键的效果

發表於 June 4, 2015   |   作者: Tim   |   分类: 技术   |   评论

比百度各种搜索出来的方法都要好用

$('body').on('keydown', 'input, select', function(e) {
    return enter2tab(this,e);
});
function enter2tab(obj,e){
    var self = $(obj)
    , form = self.parents('form:eq(0)')
    , focusable
    , next
    ;
  if (e.keyCode == 13) {
      focusable = form.find('input,select,button').filter(':visible');
      next = focusable.eq(focusable.index(obj)+1);
      if (next.length) {
          next.focus();
      } else {
          form.submit();
      }
      return false;
  }
}
javascript, enter2tab, 用户体验
[MYSQL]让字符串类型的数字按照正确的姿态排序
nodejs/phonegap 安装插件慢?配置淘宝npm源

钜添

56 文章
2 分類
1 页面
GitHub 日记技术
php apache centos macos mysql https shadowsocks mac 微信 ups svn javascript outline accesskey Chrome Extension letsencrypt ssl free certification certbo wildcard renew cloudflare pgsql 归档 binlog isset array_key_exists redmine axure
© 2026 钜添   |   文章 RSS     |  登录
由 Typecho 强力驱动
主題 - NexT
Send message encrypted and private - Msg2
Build your Under Construction Page without hosting - UnderConstruct.IO